summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/next-solver/unevaluated-const-impl-trait-ref.rs
blob: 77a169d48deac0ab8abefc8bb5f23fb4a360cbeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// compile-flags: -Znext-solver
// revisions: works fails
//[works] check-pass

trait Trait<const N: usize> {}

impl Trait<{ 1 - 1 }> for () {}
impl Trait<{ 1 + 1 }> for () {}

fn needs<const N: usize>() where (): Trait<N> {}

#[cfg(works)]
fn main() {
    needs::<0>();
    needs::<2>();
}

#[cfg(fails)]
fn main() {
    needs::<1>();
    //[fails]~^ ERROR the trait bound `(): Trait<1>` is not satisfied
}