@@ -22,15 +22,21 @@ pub struct AssociatedTyValueId<I: Interner>(pub I::DefId);
22
22
chalk_ir:: id_visit!( AssociatedTyValueId ) ;
23
23
chalk_ir:: id_fold!( AssociatedTyValueId ) ;
24
24
25
+ /// Data about a trait implementation.
25
26
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Visit ) ]
26
27
pub struct ImplDatum < I : Interner > {
28
+ /// Whether this is an `impl Trait` or `impl !Trait`
27
29
pub polarity : Polarity ,
30
+ /// Bindings of variables from the where clauses in the trait.
28
31
pub binders : Binders < ImplDatumBound < I > > ,
32
+ /// Whether this impl is local to this crate or from an external crate
29
33
pub impl_type : ImplType ,
34
+ /// IDs for associated types `type T = SomeTy`
30
35
pub associated_ty_value_ids : Vec < AssociatedTyValueId < I > > ,
31
36
}
32
37
33
38
impl < I : Interner > ImplDatum < I > {
39
+ /// True if this is an `impl Trait`, false if `impl !Trait`
34
40
pub fn is_positive ( & self ) -> bool {
35
41
self . polarity . is_positive ( )
36
42
}
@@ -39,6 +45,7 @@ impl<I: Interner> ImplDatum<I> {
39
45
self . binders . skip_binders ( ) . trait_ref . trait_id
40
46
}
41
47
48
+ /// Gets the [`AdtId`] for the `Self` type of this impl.
42
49
pub fn self_type_adt_id ( & self , interner : & I ) -> Option < AdtId < I > > {
43
50
match self
44
51
. binders
@@ -59,6 +66,7 @@ pub struct ImplDatumBound<I: Interner> {
59
66
pub where_clauses : Vec < QuantifiedWhereClause < I > > ,
60
67
}
61
68
69
+ /// Whether this impl is local to this crate or from an external crate
62
70
#[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
63
71
pub enum ImplType {
64
72
Local ,
@@ -712,7 +720,9 @@ pub struct GeneratorWitnessExistential<I: Interner> {
712
720
713
721
#[ derive( Copy , Clone , PartialEq , Eq , Hash , PartialOrd , Ord , Debug ) ]
714
722
pub enum Polarity {
723
+ /// `impl Trait for ..`
715
724
Positive ,
725
+ /// `impl !Trait for ..`
716
726
Negative ,
717
727
}
718
728
0 commit comments