@@ -18,15 +18,23 @@ use std::ops::ControlFlow;
18
18
#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
19
19
pub struct AssociatedTyValueId < I : Interner > ( pub I :: DefId ) ;
20
20
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
+
21
25
chalk_ir:: id_visit!( AssociatedTyValueId ) ;
22
26
chalk_ir:: id_fold!( AssociatedTyValueId ) ;
23
27
28
+ chalk_ir:: id_visit!( AssociatedConstValueId ) ;
29
+ chalk_ir:: id_fold!( AssociatedConstValueId ) ;
30
+
24
31
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Visit ) ]
25
32
pub struct ImplDatum < I : Interner > {
26
33
pub polarity : Polarity ,
27
34
pub binders : Binders < ImplDatumBound < I > > ,
28
35
pub impl_type : ImplType ,
29
36
pub associated_ty_value_ids : Vec < AssociatedTyValueId < I > > ,
37
+ pub associated_const_value_ids : Vec < AssociatedConstValueId < I > > ,
30
38
}
31
39
32
40
impl < I : Interner > ImplDatum < I > {
@@ -619,6 +627,33 @@ pub struct AssociatedTyValue<I: Interner> {
619
627
pub value : Binders < AssociatedTyValueBound < I > > ,
620
628
}
621
629
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
+
622
657
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Fold , Visit , HasInterner ) ]
623
658
pub struct AssociatedTyValueBound < I : Interner > {
624
659
/// Type that we normalize to. The X in `type Foo<'a> = X`.
0 commit comments