Skip to content

Commit 92da110

Browse files
committed
add test for rust-lang#122301 to cover behavior that's on stable
if this ought to be broken it should at least happen intentionally
1 parent 3cbb932 commit 92da110

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@ check-pass
2+
3+
// issue 122301 - currently the only way to supress
4+
// const eval and codegen of code conditional on some other const
5+
6+
struct Foo<T, const N: usize>(T);
7+
8+
impl<T, const N: usize> Foo<T, N> {
9+
const BAR: () = if N == 0 {
10+
panic!()
11+
};
12+
}
13+
14+
struct Invoke<T, const N: usize>(T);
15+
16+
impl<T, const N: usize> Invoke<T, N> {
17+
const FUN: fn() = if N != 0 {
18+
|| Foo::<T, N>::BAR
19+
} else {
20+
|| {}
21+
};
22+
}
23+
24+
fn main() {
25+
Invoke::<(), 0>::FUN();
26+
}

0 commit comments

Comments
 (0)