// ICE unexpected inference var // issue: rust-lang/rust#116599 //@ check-pass pub trait EvaluateConstMethods { type Trait: TraitWithConstMethods; /// **This block breaks** const DATA_3: Data3 = { <<::Method2 as ConstFn<_, _>>::Body< <::Method1 as ConstFn<_, _>>::Body, > as Contains<_>>::ITEM }; } pub trait TraitWithConstMethods { /// "const trait method" of signature `fn(Data1) -> Data2` type Method1: ConstFn; /// "const trait method" of signature `fn(Data2) -> Data3` type Method2: ConstFn; } /// A trait which tries to implement const methods in traits pub trait ConstFn { type Body>: Contains; } /// A ZST which represents / "contains" a const value which can be pass to a [`ConstFn`] pub trait Contains { const ITEM: T; } pub struct ContainsData1; impl Contains for ContainsData1 { const ITEM: Data1 = Data1 {}; } // Arbitrary data pub struct Data1 {} pub struct Data2 {} pub struct Data3 {} pub fn main() {}