Rollup merge of #114972 - nbdd0121:const_check, r=compiler-errors
Add a test to check that inline const is in required_consts This was a commit in #104087. This commit, as a test, can go in while the overall inline const stabilisation is blocked. Suggested in https://github.com/rust-lang/rust/issues/76001#issuecomment-1315975027
This commit is contained in:
commit
d8bde4878a
13
tests/ui/inline-const/required-const.rs
Normal file
13
tests/ui/inline-const/required-const.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// build-fail
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
#![feature(inline_const)]
|
||||
|
||||
fn foo<T>() {
|
||||
if false {
|
||||
const { panic!() } //~ ERROR E0080
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo::<i32>();
|
||||
}
|
11
tests/ui/inline-const/required-const.stderr
Normal file
11
tests/ui/inline-const/required-const.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed
|
||||
--> $DIR/required-const.rs:7:17
|
||||
|
|
||||
LL | const { panic!() }
|
||||
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/required-const.rs:7:17
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
Loading…
x
Reference in New Issue
Block a user