@@ -18,15 +18,23 @@ use std::ops::ControlFlow;
1818#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
1919pub struct AssociatedTyValueId < I : Interner > ( pub I :: DefId ) ;
2020
21+ /// Identifier for an "associated const value" found in some impl.
22+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
23+ pub struct AssociatedConstValueId < I : Interner > ( pub I :: DefId ) ;
24+
2125chalk_ir:: id_visit!( AssociatedTyValueId ) ;
2226chalk_ir:: id_fold!( AssociatedTyValueId ) ;
2327
28+ chalk_ir:: id_visit!( AssociatedConstValueId ) ;
29+ chalk_ir:: id_fold!( AssociatedConstValueId ) ;
30+
2431#[ derive( Clone , Debug , PartialEq , Eq , Hash , Visit ) ]
2532pub struct ImplDatum < I : Interner > {
2633 pub polarity : Polarity ,
2734 pub binders : Binders < ImplDatumBound < I > > ,
2835 pub impl_type : ImplType ,
2936 pub associated_ty_value_ids : Vec < AssociatedTyValueId < I > > ,
37+ pub associated_const_value_ids : Vec < AssociatedConstValueId < I > > ,
3038}
3139
3240impl < I : Interner > ImplDatum < I > {
@@ -619,6 +627,33 @@ pub struct AssociatedTyValue<I: Interner> {
619627 pub value : Binders < AssociatedTyValueBound < I > > ,
620628}
621629
630+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , Fold , Visit ) ]
631+ pub struct AssociatedConstValue < I : Interner > {
632+ /// Impl in which this associated type value is found. You might
633+ /// need to look at this to find the generic parameters defined on
634+ /// the impl, for example.
635+ ///
636+ /// ```ignore
637+ /// impl Iterator for Foo { // <-- refers to this impl
638+ /// const Item: usize = XXX; // <-- (where this is self)
639+ /// }
640+ /// ```
641+ pub impl_id : ImplId < I > ,
642+
643+ /// Associated type being defined.
644+ ///
645+ /// ```ignore
646+ /// impl Iterator for Foo {
647+ /// const Item: usize = XXX; // <-- (where this is self)
648+ /// }
649+ /// ...
650+ /// trait Iterator {
651+ /// const Item: usize; // <-- refers to this declaration here!
652+ /// }
653+ /// ```
654+ pub associated_const_id : AssocItemId < I > ,
655+ }
656+
622657#[ derive( Clone , Debug , PartialEq , Eq , Hash , Fold , Visit , HasInterner ) ]
623658pub struct AssociatedTyValueBound < I : Interner > {
624659 /// Type that we normalize to. The X in `type Foo<'a> = X`.
0 commit comments