Skip to content

Commit bdd3826

Browse files
committed
Add a test for rust-lang#44255
1 parent 987d71f commit bdd3826

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/test/ui/issues/issue-44255.rs

+29
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)