2021-08-27 11:04:57 -05:00
|
|
|
// check-pass
|
|
|
|
#![feature(generic_const_exprs)]
|
2020-09-10 12:43:53 -05:00
|
|
|
#![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 ()
|
2021-08-27 11:04:57 -05:00
|
|
|
where (): If<{N == 0}> {
|
2020-09-10 12:43:53 -05:00
|
|
|
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() {}
|