Skip to content

Commit 14c3705

Browse files
Ensure that the const-eval engine handles #[unwind(aborts)]
1 parent a5f0831 commit 14c3705

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(unwind_attributes, const_panic)]
2+
3+
#[unwind(aborts)]
4+
const fn foo() {
5+
panic!() //~ evaluation of constant value failed
6+
}
7+
8+
const _: () = foo(); //~ any use of this value will cause an error
9+
10+
fn main() {
11+
let _ = foo();
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0080]: evaluation of constant value failed
2+
--> $DIR/unwind-abort.rs:5:5
3+
|
4+
LL | panic!()
5+
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:5:5
6+
|
7+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
8+
9+
error: any use of this value will cause an error
10+
--> $DIR/unwind-abort.rs:8:15
11+
|
12+
LL | const _: () = foo();
13+
| --------------^^^^^-
14+
| |
15+
| referenced constant has errors
16+
|
17+
= note: `#[deny(const_err)]` on by default
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)