summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs
blob: 340e35e1c65ded64fd817deabefdc9d2453ccc88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// check-pass

// We previously always returned ambiguity when equating generic consts, even if they
// only contain generic parameters. This is incorrect as trying to unify `N > 1` with `M > 1`
// should fail.
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

enum Assert<const COND: bool> {}
trait IsTrue {}
impl IsTrue for Assert<true> {}

struct Foo<const N: usize, const M: usize>;
trait Bar<const N: usize, const M: usize> {}
impl<const N: usize, const M: usize> Bar<N, M> for Foo<N, M>
where
    Assert<{ N > 1 }>: IsTrue,
    Assert<{ M > 1 }>: IsTrue,
{
}

fn main() {}