]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs
Move generic error message to separate branches
[rust.git] / src / test / ui / const-generics / generic_const_exprs / evaluated-to-ambig.rs
1 // check-pass
2
3 // We previously always returned ambiguity when equating generic consts, even if they
4 // only contain generic parameters. This is incorrect as trying to unify `N > 1` with `M > 1`
5 // should fail.
6 #![allow(incomplete_features)]
7 #![feature(generic_const_exprs)]
8
9 enum Assert<const COND: bool> {}
10 trait IsTrue {}
11 impl IsTrue for Assert<true> {}
12
13 struct Foo<const N: usize, const M: usize>;
14 trait Bar<const N: usize, const M: usize> {}
15 impl<const N: usize, const M: usize> Bar<N, M> for Foo<N, M>
16 where
17     Assert<{ N > 1 }>: IsTrue,
18     Assert<{ M > 1 }>: IsTrue,
19 {
20 }
21
22 fn main() {}