Skip to content

Commit 66bd53a

Browse files
committed
Fix rebase
Update docs for custom normalization of test output
1 parent c3a7d36 commit 66bd53a

19 files changed

+103
-67
lines changed

src/test/COMPILER_TESTS.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,15 @@ Sometimes these built-in normalizations are not enough. In such cases, you
133133
may provide custom normalization rules using the header commands, e.g.
134134

135135
```
136-
// normalize-stderr-32bit: "fn() (32 bits)" -> "fn() ($PTR bits)"
137-
// normalize-stderr-64bit: "fn() (64 bits)" -> "fn() ($PTR bits)"
136+
// normalize-stdout-test: "foo" -> "bar"
137+
// normalize-stderr-32bit: "fn\(\) \(32 bits\)" -> "fn\(\) \($$PTR bits\)"
138+
// normalize-stderr-64bit: "fn\(\) \(64 bits\)" -> "fn\(\) \($$PTR bits\)"
138139
```
139140

140141
This tells the test, on 32-bit platforms, whenever the compiler writes
141142
`fn() (32 bits)` to stderr, it should be normalized to read `fn() ($PTR bits)`
142-
instead. Similar for 64-bit.
143+
instead. Similar for 64-bit. The replacement is performed by regexes using
144+
default regex flavor provided by `regex` crate.
143145

144146
The corresponding reference file will use the normalized output to test both
145147
32-bit and 64-bit platforms:
@@ -156,4 +158,5 @@ Please see `ui/transmute/main.rs` and `.stderr` for a concrete usage example.
156158

157159
Besides `normalize-stderr-32bit` and `-64bit`, one may use any target
158160
information or stage supported by `ignore-X` here as well (e.g.
159-
`normalize-stderr-windows`).
161+
`normalize-stderr-windows` or simply `normalize-stderr-test` for unconditional
162+
replacement).
File renamed without changes.

src/test/ui/const-eval-overflow-4.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
warning: constant evaluation error: attempt to add with overflow
2+
--> $DIR/const-eval-overflow-4.rs:23:13
3+
|
4+
23 | : [u32; (i8::MAX as i8 + 1i8) as usize]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(const_err)] on by default
8+
19
error[E0080]: constant evaluation error
210
--> $DIR/const-eval-overflow-4.rs:23:13
311
|

src/test/ui/const-fn-error.stderr

+37-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,46 @@
1+
warning: constant evaluation error: non-constant path in constant expression
2+
--> $DIR/const-fn-error.rs:27:19
3+
|
4+
27 | let a : [i32; f(X)];
5+
| ^^^^
6+
|
7+
= note: #[warn(const_err)] on by default
8+
9+
error[E0016]: blocks in constant functions are limited to items and tail expressions
10+
--> $DIR/const-fn-error.rs:16:19
11+
|
12+
16 | let mut sum = 0; //~ ERROR blocks in constant functions are limited
13+
| ^
14+
15+
error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors
16+
--> $DIR/const-fn-error.rs:17:5
17+
|
18+
17 | / for i in 0..x { //~ ERROR calls in constant functions
19+
18 | | //~| ERROR constant function contains unimplemented
20+
19 | | sum += i;
21+
20 | | }
22+
| |_____^
23+
24+
error[E0019]: constant function contains unimplemented expression type
25+
--> $DIR/const-fn-error.rs:17:5
26+
|
27+
17 | / for i in 0..x { //~ ERROR calls in constant functions
28+
18 | | //~| ERROR constant function contains unimplemented
29+
19 | | sum += i;
30+
20 | | }
31+
| |_____^
32+
133
error[E0080]: constant evaluation error
2-
--> $DIR/const-fn-error.rs:20:5
34+
--> $DIR/const-fn-error.rs:21:5
335
|
4-
20 | sum //~ ERROR E0080
36+
21 | sum //~ ERROR E0080
537
| ^^^ non-constant path in constant expression
638
|
739
note: for constant expression here
8-
--> $DIR/const-fn-error.rs:26:13
40+
--> $DIR/const-fn-error.rs:27:13
941
|
10-
26 | let a : [i32; f(X)];
42+
27 | let a : [i32; f(X)];
1143
| ^^^^^^^^^^^
1244

13-
error: aborting due to previous error
45+
error: aborting due to 4 previous errors
1446

src/test/ui/const-len-underflow-separate-spans.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
const ONE: usize = 1;
1616
const TWO: usize = 2;
1717
const LEN: usize = ONE - TWO;
18-
//~^ ERROR E0080
19-
//~| attempt to subtract with overflow
20-
//~| NOTE attempt to subtract with overflow
21-
//~| NOTE on by default
18+
//~^ ERROR constant evaluation error [E0080]
19+
//~| WARN attempt to subtract with overflow
2220

2321
fn main() {
2422
let a: [i8; LEN] = unimplemented!();

src/test/ui/const-len-underflow-separate-spans.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
warning: constant evaluation error: attempt to subtract with overflow
2+
--> $DIR/const-len-underflow-separate-spans.rs:17:20
3+
|
4+
17 | const LEN: usize = ONE - TWO;
5+
| ^^^^^^^^^
6+
|
7+
= note: #[warn(const_err)] on by default
8+
19
error[E0080]: constant evaluation error
210
--> $DIR/const-len-underflow-separate-spans.rs:17:20
311
|

src/test/ui/issue-17954.stderr

-13
This file was deleted.

src/test/ui/issue-18819.stderr

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
2-
--> $DIR/issue-18819.rs:26:13
2+
--> $DIR/issue-18819.rs:26:5
33
|
4-
21 | / fn print_x(_: &Foo<Item=bool>, extra: &str) {
5-
22 | | println!("{}", extra);
6-
23 | | }
7-
| |_- defined here
4+
21 | fn print_x(_: &Foo<Item=bool>, extra: &str) {
5+
| ------------------------------------------- defined here
86
...
9-
26 | print_x(X);
10-
| ^ expected 2 parameters
7+
26 | print_x(X);
8+
| ^^^^^^^^^^ expected 2 parameters
119

1210
error: aborting due to previous error
1311

src/test/ui/issue-30255.rs

+1
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 {
3030
panic!();
3131
}
3232

33+
fn main() {}

src/test/ui/issue-3044.stderr

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
2-
--> $DIR/issue-3044.rs:14:28
2+
--> $DIR/issue-3044.rs:14:23
33
|
4-
14 | needlesArr.iter().fold(|x, y| {
5-
| ____________________________^
6-
15 | | });
7-
| |_____^ expected 2 parameters
4+
14 | needlesArr.iter().fold(|x, y| {
5+
| ^^^^ expected 2 parameters
86

97
error: aborting due to previous error
108

src/test/ui/issue-4935.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0061]: this function takes 1 parameter but 2 parameters were supplied
2-
--> $DIR/issue-4935.rs:15:17
2+
--> $DIR/issue-4935.rs:15:13
33
|
44
13 | fn foo(a: usize) {}
5-
| ------------------- defined here
5+
| ---------------- defined here
66
14 | //~^ defined here
77
15 | fn main() { foo(5, 6) }
8-
| ^^^^ expected 1 parameter
8+
| ^^^^^^^^^ expected 1 parameter
99

1010
error: aborting due to previous error
1111

src/test/ui/method-call-err-msg.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
error[E0061]: this function takes 0 parameters but 1 parameter was supplied
2-
--> $DIR/method-call-err-msg.rs:25:7
2+
--> $DIR/method-call-err-msg.rs:22:7
33
|
44
15 | fn zero(self) -> Foo { self }
55
| -------------------- defined here
66
...
7-
25 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied
7+
22 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied
88
| ^^^^ expected 0 parameters
99

1010
error[E0061]: this function takes 1 parameter but 0 parameters were supplied
1111
--> $DIR/method-call-err-msg.rs:23:7
1212
|
13-
17 | fn one(self, _: isize) -> Foo { self }
13+
16 | fn one(self, _: isize) -> Foo { self }
1414
| ----------------------------- defined here
1515
...
1616
23 | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied
1717
| ^^^ expected 1 parameter
1818

1919
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
20-
--> $DIR/method-call-err-msg.rs:29:7
20+
--> $DIR/method-call-err-msg.rs:24:7
2121
|
22-
19 | fn two(self, _: isize, _: isize) -> Foo { self }
22+
17 | fn two(self, _: isize, _: isize) -> Foo { self }
2323
| --------------------------------------- defined here
2424
...
25-
29 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied
25+
24 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied
2626
| ^^^ expected 2 parameters
2727

2828
error[E0599]: no method named `take` found for type `Foo` in the current scope

src/test/ui/mismatched_types/fn-variance-1.rs

-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
// except according to those terms.
1010

1111
fn takes_imm(x: &isize) { }
12-
//~^ NOTE found signature
1312

1413
fn takes_mut(x: &mut isize) { }
15-
//~^ NOTE found signature
1614

1715
fn apply<T, F>(t: T, f: F) where F: FnOnce(T) {
1816
f(t)

src/test/ui/mismatched_types/fn-variance-1.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error[E0631]: type mismatch in function arguments
2-
--> $DIR/fn-variance-1.rs:23:5
2+
--> $DIR/fn-variance-1.rs:21:5
33
|
4-
14 | fn takes_mut(x: &mut isize) { }
4+
13 | fn takes_mut(x: &mut isize) { }
55
| --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _`
66
...
7-
23 | apply(&3, takes_mut);
7+
21 | apply(&3, takes_mut);
88
| ^^^^^ expected signature of `fn(&{integer}) -> _`
99
|
1010
= note: required by `apply`
1111

1212
error[E0631]: type mismatch in function arguments
13-
--> $DIR/fn-variance-1.rs:29:5
13+
--> $DIR/fn-variance-1.rs:25:5
1414
|
1515
11 | fn takes_imm(x: &isize) { }
1616
| ----------------------- found signature of `for<'r> fn(&'r isize) -> _`
1717
...
18-
29 | apply(&mut 3, takes_imm);
18+
25 | apply(&mut 3, takes_imm);
1919
| ^^^^^ expected signature of `fn(&mut {integer}) -> _`
2020
|
2121
= note: required by `apply`

src/test/ui/mismatched_types/overloaded-calls-bad.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied
1414
| ^^^ expected 1 parameter
1515

1616
error[E0057]: this function takes 1 parameter but 2 parameters were supplied
17-
--> $DIR/overloaded-calls-bad.rs:44:15
17+
--> $DIR/overloaded-calls-bad.rs:41:15
1818
|
19-
44 | let ans = s("burma", "shave");
19+
41 | let ans = s("burma", "shave");
2020
| ^^^^^^^^^^^^^^^^^^^ expected 1 parameter
2121

2222
error: aborting due to 3 previous errors

src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ error[E0631]: type mismatch in closure arguments
33
|
44
22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
55
| ----------------------------- found signature of `fn(usize, isize) -> _`
6-
23 | //~^ NOTE found signature of `fn(usize, isize)
7-
24 | let z = call_it(3, f);
6+
23 | let z = call_it(3, f);
87
| ^^^^^^^ expected signature of `fn(isize, isize) -> _`
98
|
109
= note: required by `call_it`
+5-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
error[E0061]: this function takes 4 parameters but 3 parameters were supplied
2-
--> $DIR/not-enough-arguments.rs:20:7
2+
--> $DIR/not-enough-arguments.rs:20:3
33
|
4-
15 | / fn foo(a: isize, b: isize, c: isize, d:isize) {
5-
16 | | panic!();
6-
17 | | }
7-
| |_- defined here
4+
15 | fn foo(a: isize, b: isize, c: isize, d:isize) {
5+
| --------------------------------------------- defined here
86
...
9-
20 | foo(1, 2, 3);
10-
| ^^^^^^^ expected 4 parameters
7+
20 | foo(1, 2, 3);
8+
| ^^^^^^^^^^^^ expected 4 parameters
119

1210
error: aborting due to previous error
1311

src/test/ui/union/union-const-eval.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
warning: constant evaluation error: nonexistent struct field
2+
--> $DIR/union-const-eval.rs:21:21
3+
|
4+
21 | let b: [u8; C.b]; //~ ERROR constant evaluation error
5+
| ^^^
6+
|
7+
= note: #[warn(const_err)] on by default
8+
19
error[E0080]: constant evaluation error
210
--> $DIR/union-const-eval.rs:21:21
311
|

src/test/ui/variadic-ffi-3.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ error[E0060]: this function takes at least 2 parameters but 0 parameters were su
88
| ^^^^^ expected at least 2 parameters
99

1010
error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied
11-
--> $DIR/variadic-ffi-3.rs:22:13
11+
--> $DIR/variadic-ffi-3.rs:22:9
1212
|
1313
12 | fn foo(f: isize, x: u8, ...);
1414
| ----------------------------- defined here
1515
...
1616
22 | foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied
17-
| ^ expected at least 2 parameters
17+
| ^^^^^^ expected at least 2 parameters
1818

1919
error[E0308]: mismatched types
2020
--> $DIR/variadic-ffi-3.rs:24:56

0 commit comments

Comments
 (0)