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

Lines changed: 7 additions & 4 deletions
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 37 additions & 5 deletions
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

Lines changed: 2 additions & 4 deletions
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/test/ui/issue-18819.stderr

Lines changed: 5 additions & 7 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 5 deletions
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

0 commit comments

Comments
 (0)