We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 987d71f commit bdd3826Copy full SHA for bdd3826
src/test/ui/issues/issue-44255.rs
@@ -0,0 +1,29 @@
1
+// run-pass
2
+
3
+use std::marker::PhantomData;
4
5
+fn main() {
6
+ let _arr = [1; <Multiply<Five, Five>>::VAL];
7
+}
8
9
+trait TypeVal<T> {
10
+ const VAL: T;
11
12
13
+struct Five;
14
15
+impl TypeVal<usize> for Five {
16
+ const VAL: usize = 5;
17
18
19
+struct Multiply<N, M> {
20
+ _n: PhantomData<N>,
21
+ _m: PhantomData<M>,
22
23
24
+impl<N, M> TypeVal<usize> for Multiply<N, M>
25
+ where N: TypeVal<usize>,
26
+ M: TypeVal<usize>,
27
+{
28
+ const VAL: usize = N::VAL * M::VAL;
29
0 commit comments