File tree 2 files changed +33
-0
lines changed
src/test/ui/consts/const-eval
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
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`.
You can’t perform that action at this time.
0 commit comments