We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3cbb932 commit 92da110Copy full SHA for 92da110
tests/ui/consts/control-flow/dead_branches_dont_eval.rs
@@ -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