bless all the things

This commit is contained in:
Ralf Jung 2019-07-25 09:11:53 +02:00
parent 5fa443ddee
commit f06a274880
3 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,5 @@
error[E0658]: casting pointers to integers in constants is unstable
--> $DIR/match-test-ptr-null.rs:7:15
--> $DIR/match-test-ptr-null.rs:6:15
|
LL | match &1 as *const i32 as usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -8,19 +8,19 @@ LL | match &1 as *const i32 as usize {
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
error[E0019]: constant contains unimplemented expression type
--> $DIR/match-test-ptr-null.rs:7:15
--> $DIR/match-test-ptr-null.rs:6:15
|
LL | match &1 as *const i32 as usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0019]: constant contains unimplemented expression type
--> $DIR/match-test-ptr-null.rs:11:13
--> $DIR/match-test-ptr-null.rs:10:13
|
LL | 0 => 42,
| ^
error[E0080]: evaluation of constant value failed
--> $DIR/match-test-ptr-null.rs:7:15
--> $DIR/match-test-ptr-null.rs:6:15
|
LL | match &1 as *const i32 as usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants

View File

@ -1,4 +1,4 @@
fn main() {
let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants
//~^ ERROR it is undefined behavior to use this value
//~^ ERROR evaluation of constant value failed
}

View File

@ -7,13 +7,11 @@ LL | let _ = [0; (&0 as *const i32) as usize];
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
error[E0080]: it is undefined behavior to use this value
error[E0080]: evaluation of constant value failed
--> $DIR/issue-52023-array-size-pointer-cast.rs:2:17
|
LL | let _ = [0; (&0 as *const i32) as usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
|
= 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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants
error: aborting due to 2 previous errors