summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-consts/defaults-cyclic-fail.rs
blob: a1c6840a0f1b364e3f80035f1ce6212e94854f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// build-fail

// Cyclic assoc. const defaults don't error unless *used*
trait Tr {
    const A: u8 = Self::B;
    //~^ cycle detected when const-evaluating + checking `Tr::A`

    const B: u8 = Self::A;
}

// This impl is *allowed* unless its assoc. consts are used
impl Tr for () {}

fn main() {
    // This triggers the cycle error
    assert_eq!(<() as Tr>::A, 0);
}