mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
18 lines
371 B
Rust
18 lines
371 B
Rust
// 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);
|
|
}
|