Skip to content

Commit eff6381

Browse files
authored
Rollup merge of rust-lang#68290 - petrochenkov:passcheck, r=oli-obk
Fix some tests failing in `--pass check` mode Warnings reported at codegen or linking time either have to be converted to errors (preferable), or the tests for them need to be marked with `// ignore-pass` (as a last resort). rust-lang@ecd5852 turned them from errors to warnings, but that shouldn't be necessary because it's still clear from the `.stderr` output that the errors are lints and not hard-coded.
2 parents e1bd9b3 + 8fa8b81 commit eff6381

6 files changed

+28
-25
lines changed

src/test/ui/consts/array-literal-index-oob.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// build-pass
2+
// ignore-pass (emit codegen-time warnings and verify that they are indeed warnings and not errors)
23

34
#![warn(const_err)]
45

src/test/ui/consts/array-literal-index-oob.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
warning: index out of bounds: the len is 3 but the index is 4
2-
--> $DIR/array-literal-index-oob.rs:6:8
2+
--> $DIR/array-literal-index-oob.rs:7:8
33
|
44
LL | &{ [1, 2, 3][4] };
55
| ^^^^^^^^^^^^
66
|
77
note: lint level defined here
8-
--> $DIR/array-literal-index-oob.rs:3:9
8+
--> $DIR/array-literal-index-oob.rs:4:9
99
|
1010
LL | #![warn(const_err)]
1111
| ^^^^^^^^^
1212

1313
warning: reaching this expression at runtime will panic or abort
14-
--> $DIR/array-literal-index-oob.rs:6:8
14+
--> $DIR/array-literal-index-oob.rs:7:8
1515
|
1616
LL | &{ [1, 2, 3][4] };
1717
| ---^^^^^^^^^^^^--
1818
| |
1919
| indexing out of bounds: the len is 3 but the index is 4
2020

2121
warning: erroneous constant used
22-
--> $DIR/array-literal-index-oob.rs:6:5
22+
--> $DIR/array-literal-index-oob.rs:7:5
2323
|
2424
LL | &{ [1, 2, 3][4] };
2525
| ^^^^^^^^^^^^^^^^^ referenced constant has errors

src/test/ui/consts/const-eval/promoted_errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// build-pass
2+
// ignore-pass (emit codegen-time warnings and verify that they are indeed warnings and not errors)
23
// compile-flags: -O
34

45
#![warn(const_err)]

src/test/ui/consts/const-eval/promoted_errors.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
warning: this expression will panic at runtime
2-
--> $DIR/promoted_errors.rs:8:14
2+
--> $DIR/promoted_errors.rs:9:14
33
|
44
LL | let _x = 0u32 - 1;
55
| ^^^^^^^^ attempt to subtract with overflow
66
|
77
note: lint level defined here
8-
--> $DIR/promoted_errors.rs:4:9
8+
--> $DIR/promoted_errors.rs:5:9
99
|
1010
LL | #![warn(const_err)]
1111
| ^^^^^^^^^
1212

1313
warning: attempt to divide by zero
14-
--> $DIR/promoted_errors.rs:10:20
14+
--> $DIR/promoted_errors.rs:11:20
1515
|
1616
LL | println!("{}", 1 / (1 - 1));
1717
| ^^^^^^^^^^^
1818

1919
warning: reaching this expression at runtime will panic or abort
20-
--> $DIR/promoted_errors.rs:10:20
20+
--> $DIR/promoted_errors.rs:11:20
2121
|
2222
LL | println!("{}", 1 / (1 - 1));
2323
| ^^^^^^^^^^^ dividing by zero
2424

2525
warning: erroneous constant used
26-
--> $DIR/promoted_errors.rs:10:20
26+
--> $DIR/promoted_errors.rs:11:20
2727
|
2828
LL | println!("{}", 1 / (1 - 1));
2929
| ^^^^^^^^^^^ referenced constant has errors
3030

3131
warning: attempt to divide by zero
32-
--> $DIR/promoted_errors.rs:14:14
32+
--> $DIR/promoted_errors.rs:15:14
3333
|
3434
LL | let _x = 1 / (1 - 1);
3535
| ^^^^^^^^^^^
3636

3737
warning: attempt to divide by zero
38-
--> $DIR/promoted_errors.rs:16:20
38+
--> $DIR/promoted_errors.rs:17:20
3939
|
4040
LL | println!("{}", 1 / (false as u32));
4141
| ^^^^^^^^^^^^^^^^^^
4242

4343
warning: reaching this expression at runtime will panic or abort
44-
--> $DIR/promoted_errors.rs:16:20
44+
--> $DIR/promoted_errors.rs:17:20
4545
|
4646
LL | println!("{}", 1 / (false as u32));
4747
| ^^^^^^^^^^^^^^^^^^ dividing by zero
4848

4949
warning: erroneous constant used
50-
--> $DIR/promoted_errors.rs:16:20
50+
--> $DIR/promoted_errors.rs:17:20
5151
|
5252
LL | println!("{}", 1 / (false as u32));
5353
| ^^^^^^^^^^^^^^^^^^ referenced constant has errors
5454

5555
warning: attempt to divide by zero
56-
--> $DIR/promoted_errors.rs:20:14
56+
--> $DIR/promoted_errors.rs:21:14
5757
|
5858
LL | let _x = 1 / (false as u32);
5959
| ^^^^^^^^^^^^^^^^^^

src/test/ui/consts/const-eval/promoted_errors2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// build-pass
2+
// ignore-pass (emit codegen-time warnings and verify that they are indeed warnings and not errors)
23
// compile-flags: -C overflow-checks=on -O
34

45
#![warn(const_err)]

src/test/ui/consts/const-eval/promoted_errors2.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
11
warning: attempt to subtract with overflow
2-
--> $DIR/promoted_errors2.rs:7:20
2+
--> $DIR/promoted_errors2.rs:8:20
33
|
44
LL | println!("{}", 0u32 - 1);
55
| ^^^^^^^^
66
|
77
note: lint level defined here
8-
--> $DIR/promoted_errors2.rs:4:9
8+
--> $DIR/promoted_errors2.rs:5:9
99
|
1010
LL | #![warn(const_err)]
1111
| ^^^^^^^^^
1212

1313
warning: attempt to subtract with overflow
14-
--> $DIR/promoted_errors2.rs:9:14
14+
--> $DIR/promoted_errors2.rs:10:14
1515
|
1616
LL | let _x = 0u32 - 1;
1717
| ^^^^^^^^
1818

1919
warning: attempt to divide by zero
20-
--> $DIR/promoted_errors2.rs:11:20
20+
--> $DIR/promoted_errors2.rs:12:20
2121
|
2222
LL | println!("{}", 1 / (1 - 1));
2323
| ^^^^^^^^^^^
2424

2525
warning: reaching this expression at runtime will panic or abort
26-
--> $DIR/promoted_errors2.rs:11:20
26+
--> $DIR/promoted_errors2.rs:12:20
2727
|
2828
LL | println!("{}", 1 / (1 - 1));
2929
| ^^^^^^^^^^^ dividing by zero
3030

3131
warning: erroneous constant used
32-
--> $DIR/promoted_errors2.rs:11:20
32+
--> $DIR/promoted_errors2.rs:12:20
3333
|
3434
LL | println!("{}", 1 / (1 - 1));
3535
| ^^^^^^^^^^^ referenced constant has errors
3636

3737
warning: attempt to divide by zero
38-
--> $DIR/promoted_errors2.rs:15:14
38+
--> $DIR/promoted_errors2.rs:16:14
3939
|
4040
LL | let _x = 1 / (1 - 1);
4141
| ^^^^^^^^^^^
4242

4343
warning: attempt to divide by zero
44-
--> $DIR/promoted_errors2.rs:17:20
44+
--> $DIR/promoted_errors2.rs:18:20
4545
|
4646
LL | println!("{}", 1 / (false as u32));
4747
| ^^^^^^^^^^^^^^^^^^
4848

4949
warning: reaching this expression at runtime will panic or abort
50-
--> $DIR/promoted_errors2.rs:17:20
50+
--> $DIR/promoted_errors2.rs:18:20
5151
|
5252
LL | println!("{}", 1 / (false as u32));
5353
| ^^^^^^^^^^^^^^^^^^ dividing by zero
5454

5555
warning: erroneous constant used
56-
--> $DIR/promoted_errors2.rs:17:20
56+
--> $DIR/promoted_errors2.rs:18:20
5757
|
5858
LL | println!("{}", 1 / (false as u32));
5959
| ^^^^^^^^^^^^^^^^^^ referenced constant has errors
6060

6161
warning: attempt to divide by zero
62-
--> $DIR/promoted_errors2.rs:21:14
62+
--> $DIR/promoted_errors2.rs:22:14
6363
|
6464
LL | let _x = 1 / (false as u32);
6565
| ^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)