Skip to content

Commit 52f8338

Browse files
committed
Add regression test
1 parent de68911 commit 52f8338

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/ui/inline-const/promotion.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![feature(inline_const)]
2+
#![allow(arithmetic_overflow, unconditional_panic)]
3+
// check-pass
4+
5+
// The only way to have promoteds that fail is in `const fn` called from `const`/`static`.
6+
const fn div_by_zero() -> i32 {
7+
1 / 0
8+
}
9+
10+
const fn mk_false() -> bool {
11+
false
12+
}
13+
14+
fn main() {
15+
let v = const {
16+
if mk_false() {
17+
let _x: &'static i32 = &div_by_zero();
18+
}
19+
42
20+
};
21+
}

0 commit comments

Comments
 (0)