rust/tests/ui/associated-consts/defaults-cyclic-fail.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
331 B
Rust
Raw Permalink Normal View History

//@ build-fail
2019-06-13 17:03:32 -05:00
// Cyclic assoc. const defaults don't error unless *used*
trait Tr {
const A: u8 = Self::B;
//~^ cycle detected
2019-06-13 17:03:32 -05:00
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);
}