Skip to content

Commit

Permalink
Add a test for rust-lang#44255
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Mar 11, 2019
1 parent ffebd92 commit c1fddd6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/test/ui/issues/issue-44255.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// run-pass

use std::marker::PhantomData;

fn main() {
let _arr = [1; <Multiply<Five, Five>>::VAL];
}

trait TypeVal<T> {
const VAL: T;
}

struct Five;

impl TypeVal<usize> for Five {
const VAL: usize = 5;
}

struct Multiply<N, M> {
_n: PhantomData<N>,
_m: PhantomData<M>,
}

impl<N, M> TypeVal<usize> for Multiply<N, M>
where N: TypeVal<usize>,
M: TypeVal<usize>,
{
const VAL: usize = N::VAL * M::VAL;
}

0 comments on commit c1fddd6

Please sign in to comment.