Skip to content

Commit 670c84d

Browse files
Fix tests broken by more consistent miri unleashed warnings
1 parent c990243 commit 670c84d

13 files changed

+82
-242
lines changed

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

Lines changed: 9 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,20 @@
11
warning: skipping const checks
2-
--> $DIR/const_fn_ptr.rs:25:5
2+
--> $DIR/const_fn_ptr.rs:12:5
33
|
4-
LL | assert_eq!(Y, 4);
5-
| ^^^^^^^^^^^^^^^^^
6-
|
7-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
8-
9-
warning: skipping const checks
10-
--> $DIR/const_fn_ptr.rs:25:5
11-
|
12-
LL | assert_eq!(Y, 4);
13-
| ^^^^^^^^^^^^^^^^^
14-
|
15-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
16-
17-
warning: skipping const checks
18-
--> $DIR/const_fn_ptr.rs:25:5
19-
|
20-
LL | assert_eq!(Y, 4);
21-
| ^^^^^^^^^^^^^^^^^
22-
|
23-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
24-
25-
warning: skipping const checks
26-
--> $DIR/const_fn_ptr.rs:27:5
27-
|
28-
LL | assert_eq!(y, 4);
29-
| ^^^^^^^^^^^^^^^^^
30-
|
31-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
32-
33-
warning: skipping const checks
34-
--> $DIR/const_fn_ptr.rs:27:5
35-
|
36-
LL | assert_eq!(y, 4);
37-
| ^^^^^^^^^^^^^^^^^
38-
|
39-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
40-
41-
warning: skipping const checks
42-
--> $DIR/const_fn_ptr.rs:27:5
43-
|
44-
LL | assert_eq!(y, 4);
45-
| ^^^^^^^^^^^^^^^^^
46-
|
47-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
48-
49-
warning: skipping const checks
50-
--> $DIR/const_fn_ptr.rs:29:5
51-
|
52-
LL | assert_eq!(y, 4);
53-
| ^^^^^^^^^^^^^^^^^
54-
|
55-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
56-
57-
warning: skipping const checks
58-
--> $DIR/const_fn_ptr.rs:29:5
59-
|
60-
LL | assert_eq!(y, 4);
61-
| ^^^^^^^^^^^^^^^^^
62-
|
63-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
4+
LL | X(x)
5+
| ^^^^
646

657
warning: skipping const checks
66-
--> $DIR/const_fn_ptr.rs:29:5
67-
|
68-
LL | assert_eq!(y, 4);
69-
| ^^^^^^^^^^^^^^^^^
8+
--> $DIR/const_fn_ptr.rs:16:5
709
|
71-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
10+
LL | X_const(x)
11+
| ^^^^^^^^^^
7212

7313
warning: skipping const checks
74-
--> $DIR/const_fn_ptr.rs:32:5
75-
|
76-
LL | assert_eq!(Z, 4);
77-
| ^^^^^^^^^^^^^^^^^
78-
|
79-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
80-
81-
warning: skipping const checks
82-
--> $DIR/const_fn_ptr.rs:32:5
83-
|
84-
LL | assert_eq!(Z, 4);
85-
| ^^^^^^^^^^^^^^^^^
86-
|
87-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
88-
89-
warning: skipping const checks
90-
--> $DIR/const_fn_ptr.rs:32:5
91-
|
92-
LL | assert_eq!(Z, 4);
93-
| ^^^^^^^^^^^^^^^^^
94-
|
95-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
96-
97-
warning: skipping const checks
98-
--> $DIR/const_fn_ptr.rs:34:5
99-
|
100-
LL | assert_eq!(z, 4);
101-
| ^^^^^^^^^^^^^^^^^
102-
|
103-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
104-
105-
warning: skipping const checks
106-
--> $DIR/const_fn_ptr.rs:34:5
107-
|
108-
LL | assert_eq!(z, 4);
109-
| ^^^^^^^^^^^^^^^^^
110-
|
111-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
112-
113-
warning: skipping const checks
114-
--> $DIR/const_fn_ptr.rs:34:5
115-
|
116-
LL | assert_eq!(z, 4);
117-
| ^^^^^^^^^^^^^^^^^
118-
|
119-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
120-
121-
warning: skipping const checks
122-
--> $DIR/const_fn_ptr.rs:36:5
123-
|
124-
LL | assert_eq!(z, 4);
125-
| ^^^^^^^^^^^^^^^^^
126-
|
127-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
128-
129-
warning: skipping const checks
130-
--> $DIR/const_fn_ptr.rs:36:5
131-
|
132-
LL | assert_eq!(z, 4);
133-
| ^^^^^^^^^^^^^^^^^
134-
|
135-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
136-
137-
warning: skipping const checks
138-
--> $DIR/const_fn_ptr.rs:36:5
139-
|
140-
LL | assert_eq!(z, 4);
141-
| ^^^^^^^^^^^^^^^^^
14+
--> $DIR/const_fn_ptr.rs:20:5
14215
|
143-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
16+
LL | x(y)
17+
| ^^^^
14418

14519
warning: constant `X_const` should have an upper case name
14620
--> $DIR/const_fn_ptr.rs:9:7

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const X: fn(usize) -> usize = double;
88

99
const fn bar(x: usize) -> usize {
1010
X(x) // FIXME: this should error someday
11+
//~^ WARN: skipping const checks
1112
}
1213

1314
fn main() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
warning: skipping const checks
2+
--> $DIR/const_fn_ptr_fail.rs:10:5
3+
|
4+
LL | X(x) // FIXME: this should error someday
5+
| ^^^^
6+

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn double(x: usize) -> usize { x * 2 }
66
const X: fn(usize) -> usize = double;
77

88
const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
9-
x(y)
9+
x(y) //~ WARN skipping const checks
1010
}
1111

1212
const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
@@ -15,12 +15,6 @@ const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
1515
fn main() {
1616
assert_eq!(Y, 4);
1717
//~^ ERROR evaluation of constant expression failed
18-
//~^^ WARN skipping const checks
19-
//~^^^ WARN skipping const checks
20-
//~^^^^ WARN skipping const checks
2118
assert_eq!(Z, 4);
2219
//~^ ERROR evaluation of constant expression failed
23-
//~^^ WARN skipping const checks
24-
//~^^^ WARN skipping const checks
25-
//~^^^^ WARN skipping const checks
2620
}

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

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,8 @@
11
warning: skipping const checks
2-
--> $DIR/const_fn_ptr_fail2.rs:16:5
3-
|
4-
LL | assert_eq!(Y, 4);
5-
| ^^^^^^^^^^^^^^^^^
6-
|
7-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
8-
9-
warning: skipping const checks
10-
--> $DIR/const_fn_ptr_fail2.rs:16:5
11-
|
12-
LL | assert_eq!(Y, 4);
13-
| ^^^^^^^^^^^^^^^^^
14-
|
15-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
16-
17-
warning: skipping const checks
18-
--> $DIR/const_fn_ptr_fail2.rs:16:5
19-
|
20-
LL | assert_eq!(Y, 4);
21-
| ^^^^^^^^^^^^^^^^^
22-
|
23-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
24-
25-
warning: skipping const checks
26-
--> $DIR/const_fn_ptr_fail2.rs:21:5
27-
|
28-
LL | assert_eq!(Z, 4);
29-
| ^^^^^^^^^^^^^^^^^
30-
|
31-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
32-
33-
warning: skipping const checks
34-
--> $DIR/const_fn_ptr_fail2.rs:21:5
35-
|
36-
LL | assert_eq!(Z, 4);
37-
| ^^^^^^^^^^^^^^^^^
38-
|
39-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
40-
41-
warning: skipping const checks
42-
--> $DIR/const_fn_ptr_fail2.rs:21:5
43-
|
44-
LL | assert_eq!(Z, 4);
45-
| ^^^^^^^^^^^^^^^^^
2+
--> $DIR/const_fn_ptr_fail2.rs:9:5
463
|
47-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
4+
LL | x(y)
5+
| ^^^^
486

497
error[E0080]: evaluation of constant expression failed
508
--> $DIR/const_fn_ptr_fail2.rs:16:5
@@ -57,7 +15,7 @@ LL | assert_eq!(Y, 4);
5715
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
5816

5917
error[E0080]: evaluation of constant expression failed
60-
--> $DIR/const_fn_ptr_fail2.rs:21:5
18+
--> $DIR/const_fn_ptr_fail2.rs:18:5
6119
|
6220
LL | assert_eq!(Z, 4);
6321
| ^^^^^^^^^^^-^^^^^

src/test/ui/consts/miri_unleashed/assoc_const.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: skipping const checks
2-
--> $DIR/assoc_const.rs:12:31
2+
--> $DIR/assoc_const.rs:12:20
33
|
44
LL | const F: u32 = (U::X, 42).1;
5-
| ^
5+
| ^^^^^^^^^^
66

77
error[E0080]: erroneous constant used
88
--> $DIR/assoc_const.rs:29:13

src/test/ui/consts/miri_unleashed/enum_discriminants.stderr

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,3 @@ warning: skipping const checks
2222
LL | if let E1::V2 { .. } = (E1::V1 { f: true }) {
2323
| ^^^^^^^^^^^^^
2424

25-
warning: skipping const checks
26-
--> $DIR/enum_discriminants.rs:108:5
27-
|
28-
LL | assert_eq!(OVERFLOW, 0);
29-
| ^^^^^^^^^^^^^^^^^^^^^^^^
30-
|
31-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
32-
33-
warning: skipping const checks
34-
--> $DIR/enum_discriminants.rs:108:5
35-
|
36-
LL | assert_eq!(OVERFLOW, 0);
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^
38-
|
39-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
40-
41-
warning: skipping const checks
42-
--> $DIR/enum_discriminants.rs:108:5
43-
|
44-
LL | assert_eq!(OVERFLOW, 0);
45-
| ^^^^^^^^^^^^^^^^^^^^^^^^
46-
|
47-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
48-
49-
warning: skipping const checks
50-
--> $DIR/enum_discriminants.rs:109:5
51-
|
52-
LL | assert_eq!(MORE_OVERFLOW, 0);
53-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54-
|
55-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
56-
57-
warning: skipping const checks
58-
--> $DIR/enum_discriminants.rs:109:5
59-
|
60-
LL | assert_eq!(MORE_OVERFLOW, 0);
61-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62-
|
63-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
64-
65-
warning: skipping const checks
66-
--> $DIR/enum_discriminants.rs:109:5
67-
|
68-
LL | assert_eq!(MORE_OVERFLOW, 0);
69-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70-
|
71-
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
72-

src/test/ui/consts/miri_unleashed/mutable_const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::cell::UnsafeCell;
77

88
// make sure we do not just intern this as mutable
99
const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
10+
//~^ WARN: skipping const checks
1011

1112
const MUTATING_BEHIND_RAW: () = {
1213
// Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.

src/test/ui/consts/miri_unleashed/mutable_const.stderr

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
warning: skipping const checks
2-
--> $DIR/mutable_const.rs:14:9
2+
--> $DIR/mutable_const.rs:9:38
3+
|
4+
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
7+
warning: skipping const checks
8+
--> $DIR/mutable_const.rs:15:9
39
|
410
LL | *MUTABLE_BEHIND_RAW = 99
511
| ^^^^^^^^^^^^^^^^^^^^^^^^
612

713
error: any use of this value will cause an error
8-
--> $DIR/mutable_const.rs:14:9
14+
--> $DIR/mutable_const.rs:15:9
915
|
1016
LL | / const MUTATING_BEHIND_RAW: () = {
1117
LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.

src/test/ui/consts/miri_unleashed/mutable_references.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ use std::cell::UnsafeCell;
66
// a test demonstrating what things we could allow with a smarter const qualification
77

88
static FOO: &&mut u32 = &&mut 42;
9+
//~^ WARN: skipping const checks
10+
//~| WARN: skipping const checks
911

1012
static BAR: &mut () = &mut ();
13+
//~^ WARN: skipping const checks
1114

1215
struct Foo<T>(T);
1316

1417
static BOO: &mut Foo<()> = &mut Foo(());
18+
//~^ WARN: skipping const checks
1519

1620
struct Meh {
1721
x: &'static UnsafeCell<i32>,
@@ -21,9 +25,11 @@ unsafe impl Sync for Meh {}
2125

2226
static MEH: Meh = Meh {
2327
x: &UnsafeCell::new(42),
28+
//~^ WARN: skipping const checks
2429
};
2530

2631
static OH_YES: &mut i32 = &mut 42;
32+
//~^ WARN: skipping const checks
2733

2834
fn main() {
2935
unsafe {

0 commit comments

Comments
 (0)