Skip to content

Commit 38fd74f

Browse files
committed
show the proper diagnostics
1 parent 7f1ce45 commit 38fd74f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Diff for: src/test/ui/consts/miri_unleashed/non_const_fn.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// compile-flags: -Zunleash-the-miri-inside-of-you
2-
#![allow(const_err)]
2+
#![warn(const_err)]
33

44
// A test demonstrating that we prevent calling non-const fn during CTFE.
55

66
fn foo() {}
77

88
const C: () = foo(); //~ WARN: skipping const checks
9+
//~^ WARN any use of this value will cause an error
910

1011
fn main() {
1112
println!("{:?}", C); //~ ERROR: evaluation of constant expression failed

Diff for: src/test/ui/consts/miri_unleashed/non_const_fn.stderr

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@ warning: skipping const checks
44
LL | const C: () = foo();
55
| ^^^^^
66

7+
warning: any use of this value will cause an error
8+
--> $DIR/non_const_fn.rs:8:15
9+
|
10+
LL | const C: () = foo();
11+
| --------------^^^^^-
12+
| |
13+
| calling non-const function `foo`
14+
|
15+
note: lint level defined here
16+
--> $DIR/non_const_fn.rs:2:9
17+
|
18+
LL | #![warn(const_err)]
19+
| ^^^^^^^^^
20+
721
error[E0080]: evaluation of constant expression failed
8-
--> $DIR/non_const_fn.rs:11:22
22+
--> $DIR/non_const_fn.rs:12:22
923
|
1024
LL | println!("{:?}", C);
1125
| ^ referenced constant has errors

0 commit comments

Comments
 (0)