File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
librustc_mir/transform/check_consts
test/ui/consts/miri_unleashed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,6 @@ impl NonConstOp for FnCallUnstable {
113
113
#[ derive( Debug ) ]
114
114
pub struct HeapAllocation ;
115
115
impl NonConstOp for HeapAllocation {
116
- const IS_SUPPORTED_IN_MIRI : bool = false ;
117
-
118
116
fn emit_error ( & self , item : & Item < ' _ , ' _ > , span : Span ) {
119
117
let mut err = struct_span_err ! (
120
118
item. tcx. sess,
Original file line number Diff line number Diff line change
1
+ // compile-flags: -Zunleash-the-miri-inside-of-you
2
+ #![ feature( const_mut_refs, box_syntax) ]
3
+ #![ deny( const_err) ]
4
+
5
+ use std:: mem:: ManuallyDrop ;
6
+
7
+ fn main ( ) { }
8
+
9
+ static TEST_BAD : & mut i32 = {
10
+ & mut * ( box 0 )
11
+ //~^ WARN skipping const check
12
+ //~| ERROR could not evaluate static initializer
13
+ //~| NOTE heap allocations
14
+ } ;
Original file line number Diff line number Diff line change
1
+ warning: skipping const checks
2
+ --> $DIR/box.rs:10:11
3
+ |
4
+ LL | &mut *(box 0)
5
+ | ^^^^^^^
6
+
7
+ error[E0080]: could not evaluate static initializer
8
+ --> $DIR/box.rs:10:11
9
+ |
10
+ LL | &mut *(box 0)
11
+ | ^^^^^^^ "heap allocations via `box` keyword" needs an rfc before being allowed inside constants
12
+
13
+ error: aborting due to previous error; 1 warning emitted
14
+
15
+ For more information about this error, try `rustc --explain E0080`.
You can’t perform that action at this time.
0 commit comments