Skip to content

Commit 6a6b330

Browse files
committed
update tests to changes on rustc master
1 parent e6f7f4a commit 6a6b330

10 files changed

+85
-57
lines changed

src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ union Nonsense {
2222

2323
fn main() {
2424
const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
25-
//~^ ERROR this constant likely exhibits undefined behavior
25+
//~^ ERROR it is undefined behavior to use this value
2626

2727
const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
2828
//~^ ERROR any use of this value will cause an error
@@ -34,7 +34,7 @@ fn main() {
3434
//~^ ERROR any use of this value will cause an error
3535

3636
const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
37-
//~^ ERROR this constant likely exhibits undefined behavior
37+
//~^ ERROR it is undefined behavior to use this value
3838

3939
const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
4040
//~^ ERROR any use of this value will cause an error
@@ -49,7 +49,7 @@ fn main() {
4949
//~^ ERROR any use of this value will cause an error
5050

5151
const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
52-
//~^ ERROR this constant likely exhibits undefined behavior
52+
//~^ ERROR it is undefined behavior to use this value
5353

5454
const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
5555
//~^ ERROR any use of this value will cause an error
@@ -58,7 +58,7 @@ fn main() {
5858
//~^ ERROR any use of this value will cause an error
5959

6060
const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
61-
//~^ ERROR this constant likely exhibits undefined behavior
61+
//~^ ERROR it is undefined behavior to use this value
6262

6363
const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
6464
//~^ ERROR any use of this value will cause an error
@@ -76,7 +76,7 @@ fn main() {
7676
//~^ ERROR any use of this value will cause an error
7777

7878
const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
79-
//~^ ERROR this constant likely exhibits undefined behavior
79+
//~^ ERROR it is undefined behavior to use this value
8080

8181
const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
8282
//~^ ERROR any use of this value will cause an error
@@ -91,7 +91,7 @@ fn main() {
9191
//~^ ERROR any use of this value will cause an error
9292

9393
const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
94-
//~^ ERROR this constant likely exhibits undefined behavior
94+
//~^ ERROR it is undefined behavior to use this value
9595

9696
const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
9797
//~^ ERROR any use of this value will cause an error
@@ -100,7 +100,7 @@ fn main() {
100100
//~^ ERROR any use of this value will cause an error
101101

102102
const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
103-
//~^ ERROR this constant likely exhibits undefined behavior
103+
//~^ ERROR it is undefined behavior to use this value
104104

105105
const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
106106
//~^ ERROR any use of this value will cause an error

src/test/ui/consts/const-eval/const-pointer-values-in-various-types.stderr

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error[E0080]: this constant likely exhibits undefined behavior
1+
error[E0080]: it is undefined behavior to use this value
22
--> $DIR/const-pointer-values-in-various-types.rs:24:5
33
|
44
LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
66
|
77
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
88

9-
error: this constant cannot be used
9+
error: any use of this value will cause an error
1010
--> $DIR/const-pointer-values-in-various-types.rs:27:5
1111
|
1212
LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
@@ -16,211 +16,211 @@ LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_
1616
|
1717
= note: #[deny(const_err)] on by default
1818

19-
error: this constant cannot be used
19+
error: any use of this value will cause an error
2020
--> $DIR/const-pointer-values-in-various-types.rs:30:5
2121
|
2222
LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^
2424
| |
2525
| a raw memory access tried to access part of a pointer value as raw bytes
2626

27-
error: this constant cannot be used
27+
error: any use of this value will cause an error
2828
--> $DIR/const-pointer-values-in-various-types.rs:33:5
2929
|
3030
LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^
3232
| |
3333
| a raw memory access tried to access part of a pointer value as raw bytes
3434

35-
error[E0080]: this constant likely exhibits undefined behavior
35+
error[E0080]: it is undefined behavior to use this value
3636
--> $DIR/const-pointer-values-in-various-types.rs:36:5
3737
|
3838
LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
3939
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
4040
|
4141
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
4242

43-
error: this constant cannot be used
43+
error: any use of this value will cause an error
4444
--> $DIR/const-pointer-values-in-various-types.rs:39:5
4545
|
4646
LL | const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
4848

49-
error: this constant cannot be used
49+
error: any use of this value will cause an error
5050
--> $DIR/const-pointer-values-in-various-types.rs:42:5
5151
|
5252
LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^^^
5454
| |
5555
| a raw memory access tried to access part of a pointer value as raw bytes
5656

57-
error: this constant cannot be used
57+
error: any use of this value will cause an error
5858
--> $DIR/const-pointer-values-in-various-types.rs:45:5
5959
|
6060
LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
6262
| |
6363
| a raw memory access tried to access part of a pointer value as raw bytes
6464

65-
error: this constant cannot be used
65+
error: any use of this value will cause an error
6666
--> $DIR/const-pointer-values-in-various-types.rs:48:5
6767
|
6868
LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
7070
| |
7171
| a raw memory access tried to access part of a pointer value as raw bytes
7272

73-
error[E0080]: this constant likely exhibits undefined behavior
73+
error[E0080]: it is undefined behavior to use this value
7474
--> $DIR/const-pointer-values-in-various-types.rs:51:5
7575
|
7676
LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
7878
|
7979
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
8080

81-
error: this constant cannot be used
81+
error: any use of this value will cause an error
8282
--> $DIR/const-pointer-values-in-various-types.rs:54:5
8383
|
8484
LL | const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
8585
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
8686

87-
error: this constant cannot be used
87+
error: any use of this value will cause an error
8888
--> $DIR/const-pointer-values-in-various-types.rs:57:5
8989
|
9090
LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
9191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^
9292
| |
9393
| a raw memory access tried to access part of a pointer value as raw bytes
9494

95-
error[E0080]: this constant likely exhibits undefined behavior
95+
error[E0080]: it is undefined behavior to use this value
9696
--> $DIR/const-pointer-values-in-various-types.rs:60:5
9797
|
9898
LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
9999
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
100100
|
101101
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
102102

103-
error: this constant cannot be used
103+
error: any use of this value will cause an error
104104
--> $DIR/const-pointer-values-in-various-types.rs:63:5
105105
|
106106
LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
107107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------------^^^
108108
| |
109109
| a raw memory access tried to access part of a pointer value as raw bytes
110110

111-
error: this constant cannot be used
111+
error: any use of this value will cause an error
112112
--> $DIR/const-pointer-values-in-various-types.rs:66:5
113113
|
114114
LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
115115
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------^^^
116116
| |
117117
| a raw memory access tried to access part of a pointer value as raw bytes
118118

119-
error: this constant cannot be used
119+
error: any use of this value will cause an error
120120
--> $DIR/const-pointer-values-in-various-types.rs:69:5
121121
|
122122
LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
123123
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------^^^
124124
| |
125125
| a raw memory access tried to access part of a pointer value as raw bytes
126126

127-
error: this constant cannot be used
127+
error: any use of this value will cause an error
128128
--> $DIR/const-pointer-values-in-various-types.rs:72:5
129129
|
130130
LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
131131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^^^
132132
| |
133133
| a raw memory access tried to access part of a pointer value as raw bytes
134134

135-
error: this constant cannot be used
135+
error: any use of this value will cause an error
136136
--> $DIR/const-pointer-values-in-various-types.rs:75:5
137137
|
138138
LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
139139
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^^^
140140
| |
141141
| a raw memory access tried to access part of a pointer value as raw bytes
142142

143-
error[E0080]: this constant likely exhibits undefined behavior
143+
error[E0080]: it is undefined behavior to use this value
144144
--> $DIR/const-pointer-values-in-various-types.rs:78:5
145145
|
146146
LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
147147
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
148148
|
149149
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
150150

151-
error: this constant cannot be used
151+
error: any use of this value will cause an error
152152
--> $DIR/const-pointer-values-in-various-types.rs:81:5
153153
|
154154
LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
155155
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
156156
| |
157157
| a raw memory access tried to access part of a pointer value as raw bytes
158158

159-
error: this constant cannot be used
159+
error: any use of this value will cause an error
160160
--> $DIR/const-pointer-values-in-various-types.rs:84:5
161161
|
162162
LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
163163
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------^^^
164164
| |
165165
| a raw memory access tried to access part of a pointer value as raw bytes
166166

167-
error: this constant cannot be used
167+
error: any use of this value will cause an error
168168
--> $DIR/const-pointer-values-in-various-types.rs:87:5
169169
|
170170
LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
171171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------^^^
172172
| |
173173
| a raw memory access tried to access part of a pointer value as raw bytes
174174

175-
error: this constant cannot be used
175+
error: any use of this value will cause an error
176176
--> $DIR/const-pointer-values-in-various-types.rs:90:5
177177
|
178178
LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
179179
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------^^^
180180
| |
181181
| a raw memory access tried to access part of a pointer value as raw bytes
182182

183-
error[E0080]: this constant likely exhibits undefined behavior
183+
error[E0080]: it is undefined behavior to use this value
184184
--> $DIR/const-pointer-values-in-various-types.rs:93:5
185185
|
186186
LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
187187
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
188188
|
189189
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
190190

191-
error: this constant cannot be used
191+
error: any use of this value will cause an error
192192
--> $DIR/const-pointer-values-in-various-types.rs:96:5
193193
|
194194
LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
195195
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^^^
196196
| |
197197
| a raw memory access tried to access part of a pointer value as raw bytes
198198

199-
error: this constant cannot be used
199+
error: any use of this value will cause an error
200200
--> $DIR/const-pointer-values-in-various-types.rs:99:5
201201
|
202202
LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
203203
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
204204
| |
205205
| a raw memory access tried to access part of a pointer value as raw bytes
206206

207-
error[E0080]: this constant likely exhibits undefined behavior
207+
error[E0080]: it is undefined behavior to use this value
208208
--> $DIR/const-pointer-values-in-various-types.rs:102:5
209209
|
210210
LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
211211
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
212212
|
213213
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
214214

215-
error: this constant cannot be used
215+
error: any use of this value will cause an error
216216
--> $DIR/const-pointer-values-in-various-types.rs:105:5
217217
|
218218
LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
219219
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------^^^
220220
| |
221221
| a raw memory access tried to access part of a pointer value as raw bytes
222222

223-
error: this constant cannot be used
223+
error: any use of this value will cause an error
224224
--> $DIR/const-pointer-values-in-various-types.rs:108:5
225225
|
226226
LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };

src/test/ui/consts/const-eval/issue-52442.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010

1111
fn main() {
1212
[(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
13+
//~^ ERROR it is undefined behavior to use this value
1314
}

src/test/ui/consts/const-eval/issue-52442.stderr

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ error[E0019]: constant contains unimplemented expression type
44
LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
55
| ^^^^^^^^^^^^^^
66

7-
error: aborting due to previous error
7+
error[E0080]: it is undefined behavior to use this value
8+
--> $DIR/issue-52442.rs:12:11
9+
|
10+
LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected the type usize
12+
|
13+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
14+
15+
error: aborting due to 2 previous errors
816

9-
For more information about this error, try `rustc --explain E0019`.
17+
Some errors occurred: E0019, E0080.
18+
For more information about an error, try `rustc --explain E0019`.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
let n: Int = 40;
1515
match n {
1616
0..=10 => {},
17-
10..=BAR => {}, //~ ERROR lower range bound must be less than or equal to upper
17+
10..=BAR => {}, //~ ERROR could not evaluate constant pattern
1818
_ => {},
1919
}
2020
}
@@ -30,4 +30,4 @@ type Int = u64;
3030
#[cfg(target_pointer_width="32")]
3131
type Int = u32;
3232

33-
const BAR: Int = unsafe { Foo { r: &42 }.f };
33+
const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined behavior to use this value

0 commit comments

Comments
 (0)