]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/miri_unleashed/non_const_fn.rs
cfb57d21ceec5ffc10a05f1e9490faa7351285c9
[rust.git] / src / test / ui / consts / miri_unleashed / non_const_fn.rs
1 // build-fail
2 // compile-flags: -Zunleash-the-miri-inside-of-you
3
4 #![warn(const_err)]
5
6 // A test demonstrating that we prevent calling non-const fn during CTFE.
7
8 fn foo() {}
9
10 const C: () = foo(); //~ WARN: skipping const checks
11 //~^ WARN any use of this value will cause an error
12
13 fn main() {
14     println!("{:?}", C);
15     //~^ ERROR: evaluation of constant expression failed
16     //~| WARN: erroneous constant used [const_err]
17 }