File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
src/test/ui/consts/miri_unleashed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,14 @@ static CMP: () = {
1111 //~| "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
1212} ;
1313
14- static INT_PTR_ARITH : ( ) = unsafe {
14+ static PTR_INT_CAST : ( ) = {
15+ let x = & 0 as * const _ as usize ;
16+ //~^ ERROR could not evaluate static initializer
17+ //~| unable to turn pointer into raw bytes
18+ let _v = x == x;
19+ } ;
20+
21+ static PTR_INT_TRANSMUTE : ( ) = unsafe {
1522 let x: usize = std:: mem:: transmute ( & 0 ) ;
1623 let _v = x + 0 ;
1724 //~^ ERROR could not evaluate static initializer
Original file line number Diff line number Diff line change @@ -5,7 +5,13 @@ LL | let _v = x == x;
55 | ^^^^^^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
66
77error[E0080]: could not evaluate static initializer
8- --> $DIR/ptr_arith.rs:16:14
8+ --> $DIR/ptr_arith.rs:15:13
9+ |
10+ LL | let x = &0 as *const _ as usize;
11+ | ^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
12+
13+ error[E0080]: could not evaluate static initializer
14+ --> $DIR/ptr_arith.rs:23:14
915 |
1016LL | let _v = x + 0;
1117 | ^^^^^ unable to turn pointer into raw bytes
@@ -17,7 +23,12 @@ help: skipping check that does not even have a feature gate
1723 |
1824LL | let _v = x == x;
1925 | ^^^^^^
26+ help: skipping check that does not even have a feature gate
27+ --> $DIR/ptr_arith.rs:15:13
28+ |
29+ LL | let x = &0 as *const _ as usize;
30+ | ^^^^^^^^^^^^^^^^^^^^^^^
2031
21- error: aborting due to 2 previous errors; 1 warning emitted
32+ error: aborting due to 3 previous errors; 1 warning emitted
2233
2334For more information about this error, try `rustc --explain E0080`.
You can’t perform that action at this time.
0 commit comments