2020-01-04 19:12:16 -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;
|
2022-02-16 03:56:01 -06:00
|
|
|
//~^ cycle detected when const-evaluating + checking `Tr::A`
|
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);
|
|
|
|
}
|