File tree Expand file tree Collapse file tree 3 files changed +7
-26
lines changed
tests/ui/consts/required-consts Expand file tree Collapse file tree 3 files changed +7
-26
lines changed Original file line number Diff line number Diff line change 11error[E0080]: evaluation panicked: explicit panic
2- --> $DIR/collect-in-promoted-const.rs:11 :19
2+ --> $DIR/collect-in-promoted-const.rs:9 :19
33 |
44LL | const C: () = panic!();
55 | ^^^^^^^^ evaluation of `Fail::<i32>::C` failed here
66
77note: erroneous constant encountered
8- --> $DIR/collect-in-promoted-const.rs:22 :21
8+ --> $DIR/collect-in-promoted-const.rs:17 :21
99 |
1010LL | let _val = &Fail::<T>::C;
1111 | ^^^^^^^^^^^^
1212
1313note: the above error was encountered while instantiating `fn f::<i32>`
14- --> $DIR/collect-in-promoted-const.rs:27 :5
14+ --> $DIR/collect-in-promoted-const.rs:22 :5
1515 |
1616LL | f::<i32>();
1717 | ^^^^^^^^^^
Original file line number Diff line number Diff line change 11error[E0080]: evaluation panicked: explicit panic
2- --> $DIR/collect-in-promoted-const.rs:11:19
3- |
4- LL | const C: () = panic!();
5- | ^^^^^^^^ evaluation of `Fail::<T>::C` failed here
6-
7- note: erroneous constant encountered
8- --> $DIR/collect-in-promoted-const.rs:22:21
9- |
10- LL | let _val = &Fail::<T>::C;
11- | ^^^^^^^^^^^^
12-
13- error[E0080]: evaluation panicked: explicit panic
14- --> $DIR/collect-in-promoted-const.rs:11:19
2+ --> $DIR/collect-in-promoted-const.rs:9:19
153 |
164LL | const C: () = panic!();
175 | ^^^^^^^^ evaluation of `Fail::<i32>::C` failed here
186
197note: erroneous constant encountered
20- --> $DIR/collect-in-promoted-const.rs:22 :21
8+ --> $DIR/collect-in-promoted-const.rs:17 :21
219 |
2210LL | let _val = &Fail::<T>::C;
2311 | ^^^^^^^^^^^^
24- |
25- = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2612
2713note: the above error was encountered while instantiating `fn f::<i32>`
28- --> $DIR/collect-in-promoted-const.rs:27 :5
14+ --> $DIR/collect-in-promoted-const.rs:22 :5
2915 |
3016LL | f::<i32>();
3117 | ^^^^^^^^^^
3218
33- error: aborting due to 2 previous errors
19+ error: aborting due to 1 previous error
3420
3521For more information about this error, try `rustc --explain E0080`.
Original file line number Diff line number Diff line change 11//@revisions: noopt opt
22//@ build-fail
33//@[noopt] compile-flags: -Copt-level=0
4- // FIXME(#61117): Respect debuginfo-level-tests, do not force debuginfo=0
5- //@[opt] compile-flags: -C debuginfo=0
64//@[opt] compile-flags: -O
75//! Make sure we error on erroneous consts even if they get promoted.
86
97struct Fail < T > ( T ) ;
108impl < T > Fail < T > {
119 const C : ( ) = panic ! ( ) ; //~ERROR evaluation panicked: explicit panic
12- //[opt]~^ ERROR evaluation panicked: explicit panic
13- // (Not sure why optimizations lead to this being emitted twice, but as long as compilation
14- // fails either way it's fine.)
1510}
1611
1712#[ inline( never) ]
You can’t perform that action at this time.
0 commit comments