File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ // ICE unexpected inference var
2+ // issue: rust-lang/rust#116599
3+ //@ check-pass
4+
5+ pub trait EvaluateConstMethods {
6+ type Trait : TraitWithConstMethods ;
7+
8+ /// **This block breaks**
9+ const DATA_3 : Data3 = {
10+ <<<Self :: Trait as TraitWithConstMethods >:: Method2 as ConstFn < _ , _ > >:: Body <
11+ <<Self :: Trait as TraitWithConstMethods >:: Method1 as ConstFn < _ , _ > >:: Body < ContainsData1 > ,
12+ > as Contains < _ > >:: ITEM
13+ } ;
14+ }
15+
16+ pub trait TraitWithConstMethods {
17+ /// "const trait method" of signature `fn(Data1) -> Data2`
18+ type Method1 : ConstFn < Data1 , Data2 > ;
19+
20+ /// "const trait method" of signature `fn(Data2) -> Data3`
21+ type Method2 : ConstFn < Data2 , Data3 > ;
22+ }
23+
24+ /// A trait which tries to implement const methods in traits
25+ pub trait ConstFn < Arg , Ret > {
26+ type Body < T : Contains < Arg > > : Contains < Ret > ;
27+ }
28+
29+ /// A ZST which represents / "contains" a const value which can be pass to a [`ConstFn`]
30+ pub trait Contains < T > {
31+ const ITEM : T ;
32+ }
33+
34+ pub struct ContainsData1 ;
35+ impl Contains < Data1 > for ContainsData1 {
36+ const ITEM : Data1 = Data1 { } ;
37+ }
38+
39+ // Arbitrary data
40+ pub struct Data1 { }
41+ pub struct Data2 { }
42+ pub struct Data3 { }
43+
44+ pub fn main ( ) { }
You can’t perform that action at this time.
0 commit comments