Skip to content

Commit d8bde48

Browse files
authored
Rollup merge of rust-lang#114972 - nbdd0121:const_check, r=compiler-errors
Add a test to check that inline const is in required_consts This was a commit in rust-lang#104087. This commit, as a test, can go in while the overall inline const stabilisation is blocked. Suggested in rust-lang#76001 (comment)
2 parents 8d52b4d + 26fe88f commit d8bde48

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// build-fail
2+
// compile-flags: -Zmir-opt-level=3
3+
#![feature(inline_const)]
4+
5+
fn foo<T>() {
6+
if false {
7+
const { panic!() } //~ ERROR E0080
8+
}
9+
}
10+
11+
fn main() {
12+
foo::<i32>();
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed
2+
--> $DIR/required-const.rs:7:17
3+
|
4+
LL | const { panic!() }
5+
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/required-const.rs:7:17
6+
|
7+
= 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)
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)