File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
src/test/ui/consts/rfc-2203-const-array-repeat-exprs Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ // ignore-compare-mode-nll
2+ // compile-flags: -Z borrowck=migrate
3+ // build-fail
4+ #![ feature( const_in_array_repeat_expressions, const_panic, const_fn) ]
5+ #![ allow( warnings) ]
6+
7+ // Some type that is not copyable.
8+ struct Bar ;
9+
10+ const fn bad_bar ( ) -> Bar { panic ! ( ) }
11+ //~^ ERROR evaluation of constant value failed
12+
13+ fn main ( ) {
14+ let arr: [ Bar ; 2 ] = [ bad_bar ( ) ; 2 ] ;
15+ //~^ ERROR erroneous constant used
16+ //~| ERROR evaluation of constant expression failed
17+ }
Original file line number Diff line number Diff line change 1+ error[E0080]: evaluation of constant value failed
2+ --> $DIR/migrate-fail2.rs:10:29
3+ |
4+ LL | const fn bad_bar() -> Bar { panic!() }
5+ | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/migrate-fail2.rs:10:29
6+ |
7+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
8+
9+ error[E0080]: evaluation of constant expression failed
10+ --> $DIR/migrate-fail2.rs:14:25
11+ |
12+ LL | let arr: [Bar; 2] = [bad_bar(); 2];
13+ | ^---------^^^^
14+ | |
15+ | referenced constant has errors
16+
17+ error: erroneous constant used
18+ --> $DIR/migrate-fail2.rs:14:25
19+ |
20+ LL | let arr: [Bar; 2] = [bad_bar(); 2];
21+ | ^^^^^^^^^^^^^^ referenced constant has errors
22+ |
23+ = note: `#[deny(const_err)]` on by default
24+
25+ error: aborting due to 3 previous errors
26+
27+ For more information about this error, try `rustc --explain E0080`.
You can’t perform that action at this time.
0 commit comments