File tree 2 files changed +27
-0
lines changed
src/test/ui/consts/miri_unleashed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ // compile-flags: -Zunleash-the-miri-inside-of-you
2
+ #![ allow( const_err) ]
3
+
4
+ // A test demonstrating that we prevent calling non-const fn during CTFE.
5
+
6
+ fn foo ( ) { }
7
+
8
+ const C : ( ) = foo ( ) ; //~ WARN: skipping const checks
9
+
10
+ fn main ( ) {
11
+ println ! ( "{:?}" , C ) ; //~ ERROR: evaluation of constant expression failed
12
+ }
Original file line number Diff line number Diff line change
1
+ warning: skipping const checks
2
+ --> $DIR/non_const_fn.rs:8:15
3
+ |
4
+ LL | const C: () = foo();
5
+ | ^^^^^
6
+
7
+ error[E0080]: evaluation of constant expression failed
8
+ --> $DIR/non_const_fn.rs:11:22
9
+ |
10
+ LL | println!("{:?}", C);
11
+ | ^ referenced constant has errors
12
+
13
+ error: aborting due to previous error
14
+
15
+ For more information about this error, try `rustc --explain E0080`.
You can’t perform that action at this time.
0 commit comments