Skip to content

Commit a909c03

Browse files
committed
remove unneeded flags; exlain why we still have const_if_match
1 parent f7f606d commit a909c03

6 files changed

+56
-27
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics
1+
// compile-flags: -Zunleash-the-miri-inside-of-you
22
#![feature(box_syntax)]
33
#![allow(const_err)]
44

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// build-fail
2-
// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics
2+
// compile-flags: -Zunleash-the-miri-inside-of-you
33
#![allow(const_err)]
44

55
use std::sync::atomic::AtomicUsize;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics
1+
// compile-flags: -Zunleash-the-miri-inside-of-you
22
#![allow(const_err)]
33

44
use std::sync::atomic::AtomicUsize;

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics
1+
// compile-flags: -Zunleash-the-miri-inside-of-you
22
// aux-build:static_cross_crate.rs
33
#![allow(const_err)]
44

5+
// `const_if_match` is a HIR check and thus needed even when unleashed.
56
#![feature(exclusive_range_pattern, half_open_range_patterns, const_if_match)]
67

78
extern crate static_cross_crate;
@@ -38,6 +39,7 @@ pub fn test(x: &[u8; 1]) -> bool {
3839
match x {
3940
SLICE_MUT => true,
4041
//~^ ERROR could not evaluate constant pattern
42+
//~| ERROR could not evaluate constant pattern
4143
&[1..] => false,
4244
}
4345
}
@@ -46,6 +48,7 @@ pub fn test2(x: &u8) -> bool {
4648
match x {
4749
U8_MUT => true,
4850
//~^ ERROR could not evaluate constant pattern
51+
//~| ERROR could not evaluate constant pattern
4952
&(1..) => false,
5053
}
5154
}
@@ -56,13 +59,15 @@ pub fn test3(x: &u8) -> bool {
5659
match x {
5760
U8_MUT2 => true,
5861
//~^ ERROR could not evaluate constant pattern
62+
//~| ERROR could not evaluate constant pattern
5963
&(1..) => false,
6064
}
6165
}
6266
pub fn test4(x: &u8) -> bool {
6367
match x {
6468
U8_MUT3 => true,
6569
//~^ ERROR could not evaluate constant pattern
70+
//~| ERROR could not evaluate constant pattern
6671
&(1..) => false,
6772
}
6873
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: it is undefined behavior to use this value
2-
--> $DIR/const_refers_to_static_cross_crate.rs:11:1
2+
--> $DIR/const_refers_to_static_cross_crate.rs:12:1
33
|
44
LL | / const SLICE_MUT: &[u8; 1] = {
55
LL | |
@@ -11,13 +11,13 @@ LL | | };
1111
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
1212

1313
error: could not evaluate constant pattern
14-
--> $DIR/const_refers_to_static_cross_crate.rs:39:9
14+
--> $DIR/const_refers_to_static_cross_crate.rs:40:9
1515
|
1616
LL | SLICE_MUT => true,
1717
| ^^^^^^^^^
1818

1919
error[E0080]: it is undefined behavior to use this value
20-
--> $DIR/const_refers_to_static_cross_crate.rs:17:1
20+
--> $DIR/const_refers_to_static_cross_crate.rs:18:1
2121
|
2222
LL | / const U8_MUT: &u8 = {
2323
LL | |
@@ -29,13 +29,13 @@ LL | | };
2929
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
3030

3131
error: could not evaluate constant pattern
32-
--> $DIR/const_refers_to_static_cross_crate.rs:47:9
32+
--> $DIR/const_refers_to_static_cross_crate.rs:49:9
3333
|
3434
LL | U8_MUT => true,
3535
| ^^^^^^
3636

3737
warning: any use of this value will cause an error
38-
--> $DIR/const_refers_to_static_cross_crate.rs:26:14
38+
--> $DIR/const_refers_to_static_cross_crate.rs:27:14
3939
|
4040
LL | / const U8_MUT2: &u8 = {
4141
LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
@@ -46,19 +46,19 @@ LL | | };
4646
| |__-
4747
|
4848
note: the lint level is defined here
49-
--> $DIR/const_refers_to_static_cross_crate.rs:24:8
49+
--> $DIR/const_refers_to_static_cross_crate.rs:25:8
5050
|
5151
LL | #[warn(const_err)]
5252
| ^^^^^^^^^
5353

5454
error: could not evaluate constant pattern
55-
--> $DIR/const_refers_to_static_cross_crate.rs:57:9
55+
--> $DIR/const_refers_to_static_cross_crate.rs:60:9
5656
|
5757
LL | U8_MUT2 => true,
5858
| ^^^^^^^
5959

6060
warning: any use of this value will cause an error
61-
--> $DIR/const_refers_to_static_cross_crate.rs:32:51
61+
--> $DIR/const_refers_to_static_cross_crate.rs:33:51
6262
|
6363
LL | / const U8_MUT3: &u8 = {
6464
LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
@@ -69,76 +69,100 @@ LL | | };
6969
| |__-
7070
|
7171
note: the lint level is defined here
72-
--> $DIR/const_refers_to_static_cross_crate.rs:30:8
72+
--> $DIR/const_refers_to_static_cross_crate.rs:31:8
7373
|
7474
LL | #[warn(const_err)]
7575
| ^^^^^^^^^
7676

7777
error: could not evaluate constant pattern
78-
--> $DIR/const_refers_to_static_cross_crate.rs:64:9
78+
--> $DIR/const_refers_to_static_cross_crate.rs:68:9
79+
|
80+
LL | U8_MUT3 => true,
81+
| ^^^^^^^
82+
83+
error: could not evaluate constant pattern
84+
--> $DIR/const_refers_to_static_cross_crate.rs:40:9
85+
|
86+
LL | SLICE_MUT => true,
87+
| ^^^^^^^^^
88+
89+
error: could not evaluate constant pattern
90+
--> $DIR/const_refers_to_static_cross_crate.rs:49:9
91+
|
92+
LL | U8_MUT => true,
93+
| ^^^^^^
94+
95+
error: could not evaluate constant pattern
96+
--> $DIR/const_refers_to_static_cross_crate.rs:60:9
97+
|
98+
LL | U8_MUT2 => true,
99+
| ^^^^^^^
100+
101+
error: could not evaluate constant pattern
102+
--> $DIR/const_refers_to_static_cross_crate.rs:68:9
79103
|
80104
LL | U8_MUT3 => true,
81105
| ^^^^^^^
82106

83107
warning: skipping const checks
84108
|
85109
help: skipping check that does not even have a feature gate
86-
--> $DIR/const_refers_to_static_cross_crate.rs:14:15
110+
--> $DIR/const_refers_to_static_cross_crate.rs:15:15
87111
|
88112
LL | unsafe { &static_cross_crate::ZERO }
89113
| ^^^^^^^^^^^^^^^^^^^^^^^^
90114
help: skipping check that does not even have a feature gate
91-
--> $DIR/const_refers_to_static_cross_crate.rs:14:15
115+
--> $DIR/const_refers_to_static_cross_crate.rs:15:15
92116
|
93117
LL | unsafe { &static_cross_crate::ZERO }
94118
| ^^^^^^^^^^^^^^^^^^^^^^^^
95119
help: skipping check that does not even have a feature gate
96-
--> $DIR/const_refers_to_static_cross_crate.rs:20:15
120+
--> $DIR/const_refers_to_static_cross_crate.rs:21:15
97121
|
98122
LL | unsafe { &static_cross_crate::ZERO[0] }
99123
| ^^^^^^^^^^^^^^^^^^^^^^^^
100124
help: skipping check that does not even have a feature gate
101-
--> $DIR/const_refers_to_static_cross_crate.rs:20:15
125+
--> $DIR/const_refers_to_static_cross_crate.rs:21:15
102126
|
103127
LL | unsafe { &static_cross_crate::ZERO[0] }
104128
| ^^^^^^^^^^^^^^^^^^^^^^^^
105129
help: skipping check that does not even have a feature gate
106-
--> $DIR/const_refers_to_static_cross_crate.rs:20:15
130+
--> $DIR/const_refers_to_static_cross_crate.rs:21:15
107131
|
108132
LL | unsafe { &static_cross_crate::ZERO[0] }
109133
| ^^^^^^^^^^^^^^^^^^^^^^^^
110134
help: skipping check that does not even have a feature gate
111-
--> $DIR/const_refers_to_static_cross_crate.rs:26:17
135+
--> $DIR/const_refers_to_static_cross_crate.rs:27:17
112136
|
113137
LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
114138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115139
help: skipping check that does not even have a feature gate
116-
--> $DIR/const_refers_to_static_cross_crate.rs:32:20
140+
--> $DIR/const_refers_to_static_cross_crate.rs:33:20
117141
|
118142
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
119143
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120144
help: skipping check that does not even have a feature gate
121-
--> $DIR/const_refers_to_static_cross_crate.rs:32:20
145+
--> $DIR/const_refers_to_static_cross_crate.rs:33:20
122146
|
123147
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
124148
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125149
help: skipping check that does not even have a feature gate
126-
--> $DIR/const_refers_to_static_cross_crate.rs:32:20
150+
--> $DIR/const_refers_to_static_cross_crate.rs:33:20
127151
|
128152
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
129153
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
130154
help: skipping check for `const_panic` feature
131-
--> $DIR/const_refers_to_static_cross_crate.rs:32:77
155+
--> $DIR/const_refers_to_static_cross_crate.rs:33:77
132156
|
133157
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
134158
| ^^^^^^^^
135159
help: skipping check that does not even have a feature gate
136-
--> $DIR/const_refers_to_static_cross_crate.rs:32:20
160+
--> $DIR/const_refers_to_static_cross_crate.rs:33:20
137161
|
138162
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
139163
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140164
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
141165

142-
error: aborting due to 6 previous errors; 3 warnings emitted
166+
error: aborting due to 10 previous errors; 3 warnings emitted
143167

144168
For more information about this error, try `rustc --explain E0080`.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics
1+
// compile-flags: -Zunleash-the-miri-inside-of-you
22
// normalize-stderr-test "alloc[0-9]+" -> "allocN"
33

44
#![deny(const_err)] // The `allow` variant is tested by `mutable_const2`.

0 commit comments

Comments
 (0)