summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/generic_const_exprs/issue-74634.rs
blob: cd1f7a9da687d9a026a7ed39804991565edfb2f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// check-pass
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

trait If<const COND: bool> {}
impl If<true> for () {}

trait IsZero<const N: u8> {
    type Answer;
}

struct True;
struct False;

impl<const N: u8> IsZero<N> for ()
where (): If<{N == 0}> {
    type Answer = True;
}

trait Foobar<const N: u8> {}

impl<const N: u8> Foobar<N> for ()
where (): IsZero<N, Answer = True> {}

impl<const N: u8> Foobar<N> for ()
where (): IsZero<N, Answer = False> {}

fn main() {}