Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4759090

Browse files
committed
adjust tests
1 parent 172abb2 commit 4759090

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+163
-200
lines changed

src/test/ui/const-ptr/out_of_bounds_read.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
44
LL | unsafe { copy_nonoverlapping(src, dst, count) }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
7-
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
7+
| memory access failed: pointer must be in-bounds for 4 bytes at offset 4, but alloc7 has size 4
88
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
99
|
1010
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@@ -23,7 +23,7 @@ error[E0080]: evaluation of constant value failed
2323
LL | unsafe { copy_nonoverlapping(src, dst, count) }
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2525
| |
26-
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
26+
| memory access failed: pointer must be in-bounds for 4 bytes at offset 4, but alloc7 has size 4
2727
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
2828
|
2929
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@@ -47,7 +47,7 @@ error[E0080]: evaluation of constant value failed
4747
LL | unsafe { copy_nonoverlapping(src, dst, count) }
4848
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4949
| |
50-
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
50+
| memory access failed: pointer must be in-bounds for 4 bytes at offset 4, but alloc7 has size 4
5151
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
5252
|
5353
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ error[E0080]: it is undefined behavior to use this value
22
--> $DIR/const-pointer-values-in-various-types.rs:26:5
33
|
44
LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc2, but expected initialized plain (non-pointer) bytes
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc3, but expected initialized plain (non-pointer) bytes
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 rustc repository if you believe it should not be considered undefined behavior.
88
= note: the raw bytes of the constant (size: 8, align: 8) {
9-
╾───────alloc2────────╼ │ ╾──────╼
9+
╾───────alloc3────────╼ │ ╾──────╼
1010
}
1111

1212
error: any use of this value will cause an error
@@ -47,11 +47,11 @@ error[E0080]: it is undefined behavior to use this value
4747
--> $DIR/const-pointer-values-in-various-types.rs:41:5
4848
|
4949
LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
50-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc18, but expected initialized plain (non-pointer) bytes
50+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc19, but expected initialized plain (non-pointer) bytes
5151
|
5252
= 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.
5353
= note: the raw bytes of the constant (size: 8, align: 8) {
54-
╾───────alloc18───────╼ │ ╾──────╼
54+
╾───────alloc19───────╼ │ ╾──────╼
5555
}
5656

5757
error[E0080]: it is undefined behavior to use this value
@@ -102,11 +102,11 @@ error[E0080]: it is undefined behavior to use this value
102102
--> $DIR/const-pointer-values-in-various-types.rs:59:5
103103
|
104104
LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
105-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc38, but expected initialized plain (non-pointer) bytes
105+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc39, but expected initialized plain (non-pointer) bytes
106106
|
107107
= 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.
108108
= note: the raw bytes of the constant (size: 8, align: 8) {
109-
╾───────alloc38───────╼ │ ╾──────╼
109+
╾───────alloc39───────╼ │ ╾──────╼
110110
}
111111

112112
error[E0080]: it is undefined behavior to use this value
@@ -135,11 +135,11 @@ error[E0080]: it is undefined behavior to use this value
135135
--> $DIR/const-pointer-values-in-various-types.rs:69:5
136136
|
137137
LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
138-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc50, but expected initialized plain (non-pointer) bytes
138+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc51, but expected initialized plain (non-pointer) bytes
139139
|
140140
= 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.
141141
= note: the raw bytes of the constant (size: 8, align: 8) {
142-
╾───────alloc50───────╼ │ ╾──────╼
142+
╾───────alloc51───────╼ │ ╾──────╼
143143
}
144144

145145
error: any use of this value will cause an error
@@ -201,11 +201,11 @@ error[E0080]: it is undefined behavior to use this value
201201
--> $DIR/const-pointer-values-in-various-types.rs:92:5
202202
|
203203
LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
204-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc71, but expected initialized plain (non-pointer) bytes
204+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc72, but expected initialized plain (non-pointer) bytes
205205
|
206206
= 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.
207207
= note: the raw bytes of the constant (size: 8, align: 8) {
208-
╾───────alloc71───────╼ │ ╾──────╼
208+
╾───────alloc72───────╼ │ ╾──────╼
209209
}
210210

211211
error: any use of this value will cause an error
@@ -256,11 +256,11 @@ error[E0080]: it is undefined behavior to use this value
256256
--> $DIR/const-pointer-values-in-various-types.rs:111:5
257257
|
258258
LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
259-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc86, but expected initialized plain (non-pointer) bytes
259+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc87, but expected initialized plain (non-pointer) bytes
260260
|
261261
= 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.
262262
= note: the raw bytes of the constant (size: 8, align: 8) {
263-
╾───────alloc86───────╼ │ ╾──────╼
263+
╾───────alloc87───────╼ │ ╾──────╼
264264
}
265265

266266
error: any use of this value will cause an error
@@ -289,11 +289,11 @@ error[E0080]: it is undefined behavior to use this value
289289
--> $DIR/const-pointer-values-in-various-types.rs:122:5
290290
|
291291
LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
292-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc95, but expected initialized plain (non-pointer) bytes
292+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc96, but expected initialized plain (non-pointer) bytes
293293
|
294294
= 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.
295295
= note: the raw bytes of the constant (size: 8, align: 8) {
296-
╾───────alloc95───────╼ │ ╾──────╼
296+
╾───────alloc96───────╼ │ ╾──────╼
297297
}
298298

299299
error: any use of this value will cause an error

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() {}
66
const Z: i32 = unsafe { *(&1 as *const i32) };
77

88
// bad, will thus error in miri
9-
const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this value will cause
10-
//~| WARN this was previously accepted by the compiler but is being phased out
11-
const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR any use of this value will cause
12-
//~| WARN this was previously accepted by the compiler but is being phased out
9+
const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
10+
//~| is not a valid pointer
11+
const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
12+
//~| is not a valid pointer
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
1-
error: any use of this value will cause an error
1+
error[E0080]: evaluation of constant value failed
22
--> $DIR/const_raw_ptr_ops2.rs:9:26
33
|
44
LL | const Z2: i32 = unsafe { *(42 as *const i32) };
5-
| -------------------------^^^^^^^^^^^^^^^^^^^---
6-
| |
7-
| unable to turn bytes into a pointer
8-
|
9-
= note: `#[deny(const_err)]` on by default
10-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
5+
| ^^^^^^^^^^^^^^^^^^^ 0x2a is not a valid pointer
126

13-
error: any use of this value will cause an error
7+
error[E0080]: evaluation of constant value failed
148
--> $DIR/const_raw_ptr_ops2.rs:11:26
159
|
1610
LL | const Z3: i32 = unsafe { *(44 as *const i32) };
17-
| -------------------------^^^^^^^^^^^^^^^^^^^---
18-
| |
19-
| unable to turn bytes into a pointer
20-
|
21-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
11+
| ^^^^^^^^^^^^^^^^^^^ 0x2c is not a valid pointer
2312

2413
error: aborting due to 2 previous errors
2514

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

src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32)
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 rustc repository if you believe it should not be considered undefined behavior.
88
= note: the raw bytes of the constant (size: 4, align: 4) {
9-
╾─alloc1──╼ │ ╾──╼
9+
╾─alloc2──╼ │ ╾──╼
1010
}
1111

1212
error: aborting due to previous error

src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32)
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 rustc repository if you believe it should not be considered undefined behavior.
88
= note: the raw bytes of the constant (size: 8, align: 8) {
9-
╾───────alloc1────────╼ │ ╾──────╼
9+
╾───────alloc2────────╼ │ ╾──────╼
1010
}
1111

1212
error: aborting due to previous error

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
22
--> $DIR/issue-49296.rs:19:16
33
|
44
LL | const X: u64 = *wat(42);
5-
| ^^^^^^^^ pointer to alloc1 was dereferenced after this allocation got freed
5+
| ^^^^^^^^ pointer to alloc2 was dereferenced after this allocation got freed
66

77
error: aborting due to previous error
88

src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ error[E0080]: it is undefined behavior to use this value
22
--> $DIR/ref_to_int_match.rs:26:1
33
|
44
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc2, but expected initialized plain (non-pointer) bytes
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc3, but expected initialized plain (non-pointer) bytes
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 rustc repository if you believe it should not be considered undefined behavior.
88
= note: the raw bytes of the constant (size: 4, align: 4) {
9-
╾─alloc2──╼ │ ╾──╼
9+
╾─alloc3──╼ │ ╾──╼
1010
}
1111

1212
error: could not evaluate constant pattern

src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ error[E0080]: it is undefined behavior to use this value
22
--> $DIR/ref_to_int_match.rs:26:1
33
|
44
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc2, but expected initialized plain (non-pointer) bytes
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc3, but expected initialized plain (non-pointer) bytes
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 rustc repository if you believe it should not be considered undefined behavior.
88
= note: the raw bytes of the constant (size: 8, align: 8) {
9-
╾───────alloc2────────╼ │ ╾──────╼
9+
╾───────alloc3────────╼ │ ╾──────╼
1010
}
1111

1212
error: could not evaluate constant pattern

0 commit comments

Comments
 (0)