2024-02-16 14:02:50 -06:00
|
|
|
//@ 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;
|
2023-09-11 02:52:45 -05:00
|
|
|
//~^ 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);
|
|
|
|
}
|