Skip to content

Commit cf2c65b

Browse files
committed
adjust tests
1 parent 2e17247 commit cf2c65b

21 files changed

+311
-28
lines changed

src/test/ui/const-ptr/forbidden_slices.32bit.stderr

+6-4
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ error[E0080]: it is undefined behavior to use this value
5555
--> $DIR/forbidden_slices.rs:27:1
5656
|
5757
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
58-
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
58+
| ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
5959
|
60-
= 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.
60+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
61+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
6162
= note: the raw bytes of the constant (size: 8, align: 4) {
6263
╾─ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
6364
}
@@ -170,9 +171,10 @@ error[E0080]: it is undefined behavior to use this value
170171
--> $DIR/forbidden_slices.rs:57:1
171172
|
172173
LL | pub static R5: &[u8] = unsafe {
173-
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
174+
| ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
174175
|
175-
= 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.
176+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
177+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
176178
= note: the raw bytes of the constant (size: 8, align: 4) {
177179
╾ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
178180
}

src/test/ui/const-ptr/forbidden_slices.64bit.stderr

+6-4
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ error[E0080]: it is undefined behavior to use this value
5555
--> $DIR/forbidden_slices.rs:27:1
5656
|
5757
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
58-
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
58+
| ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
5959
|
60-
= 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.
60+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
61+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
6162
= note: the raw bytes of the constant (size: 16, align: 8) {
6263
╾───────ALLOC_ID───────╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
6364
}
@@ -170,9 +171,10 @@ error[E0080]: it is undefined behavior to use this value
170171
--> $DIR/forbidden_slices.rs:57:1
171172
|
172173
LL | pub static R5: &[u8] = unsafe {
173-
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
174+
| ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
174175
|
175-
= 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.
176+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
177+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
176178
= note: the raw bytes of the constant (size: 16, align: 8) {
177179
╾──────ALLOC_ID───────╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
178180
}

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

+108
Large diffs are not rendered by default.

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

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ LL | *(ptr as *mut u8) = 123;
1010
= note: `#[deny(const_err)]` on by default
1111
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1212
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
13+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
14+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
1315

1416
error: aborting due to previous error
1517

@@ -26,4 +28,6 @@ LL | *(ptr as *mut u8) = 123;
2628
= note: `#[deny(const_err)]` on by default
2729
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2830
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
31+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
32+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2933

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

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
77
= note: `#[deny(const_err)]` on by default
88
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
99
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
10+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
11+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
1012

1113
error: could not evaluate constant pattern
1214
--> $DIR/ref_to_int_match.rs:7:14
@@ -32,4 +34,6 @@ LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
3234
= note: `#[deny(const_err)]` on by default
3335
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3436
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
37+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
38+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
3539

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

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
77
= note: `#[deny(const_err)]` on by default
88
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
99
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
10+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
11+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
1012

1113
error: could not evaluate constant pattern
1214
--> $DIR/ref_to_int_match.rs:7:14
@@ -32,4 +34,6 @@ LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
3234
= note: `#[deny(const_err)]` on by default
3335
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3436
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
37+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
38+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
3539

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

+20
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
1818
= note: `#[deny(const_err)]` on by default
1919
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2020
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
21+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
22+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2123

2224
error: any use of this value will cause an error
2325
--> $DIR/ub-enum.rs:30:1
@@ -27,6 +29,8 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
2729
|
2830
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2931
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
32+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
33+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
3034

3135
error[E0080]: it is undefined behavior to use this value
3236
--> $DIR/ub-enum.rs:43:1
@@ -47,6 +51,8 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
4751
|
4852
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4953
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
54+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
55+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
5056

5157
error: any use of this value will cause an error
5258
--> $DIR/ub-enum.rs:49:1
@@ -56,6 +62,8 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
5662
|
5763
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5864
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
65+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
66+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
5967

6068
error[E0080]: evaluation of constant value failed
6169
--> $DIR/ub-enum.rs:59:42
@@ -71,6 +79,8 @@ LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
7179
|
7280
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7381
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
82+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
83+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
7484

7585
error[E0080]: it is undefined behavior to use this value
7686
--> $DIR/ub-enum.rs:82:1
@@ -130,6 +140,8 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
130140
= note: `#[deny(const_err)]` on by default
131141
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
132142
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
143+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
144+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
133145

134146
Future breakage diagnostic:
135147
error: any use of this value will cause an error
@@ -141,6 +153,8 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
141153
= note: `#[deny(const_err)]` on by default
142154
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
143155
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
156+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
157+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
144158

145159
Future breakage diagnostic:
146160
error: any use of this value will cause an error
@@ -152,6 +166,8 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
152166
= note: `#[deny(const_err)]` on by default
153167
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
154168
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
169+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
170+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
155171

156172
Future breakage diagnostic:
157173
error: any use of this value will cause an error
@@ -163,6 +179,8 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
163179
= note: `#[deny(const_err)]` on by default
164180
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
165181
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
182+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
183+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
166184

167185
Future breakage diagnostic:
168186
error: any use of this value will cause an error
@@ -174,4 +192,6 @@ LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
174192
= note: `#[deny(const_err)]` on by default
175193
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
176194
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
195+
= help: this code performed an operation that depends on the underlying bytes representing a pointer
196+
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
177197

0 commit comments

Comments
 (0)