@@ -48,7 +48,7 @@ pub struct ProgramEnvironment {
48
48
/// For each trait (used for debugging):
49
49
pub trait_data : HashMap < ItemId , TraitDatum > ,
50
50
51
- /// For each trait (used for debugging):
51
+ /// For each associated type (used for debugging):
52
52
pub associated_ty_data : HashMap < ItemId , AssociatedTyDatum > ,
53
53
54
54
/// Compiled forms of the above:
@@ -97,7 +97,11 @@ impl Environment {
97
97
}
98
98
99
99
/// Generate the full set of clauses that are "syntactically implied" by the
100
- /// clauses in this environment.
100
+ /// clauses in this environment. Currently this consists of two kinds of expansions:
101
+ ///
102
+ /// - Supertraits are added, so `T: Ord` would expand to `T: Ord, T: PartialOrd`
103
+ /// - Projections imply that a trait is implemented, to `T: Iterator<Item=Foo>` expands to
104
+ /// `T: Iterator, T: Iterator<Item=Foo>`
101
105
pub fn elaborated_clauses ( & self , program : & ProgramEnvironment ) -> impl Iterator < Item = DomainGoal > {
102
106
let mut set = HashSet :: new ( ) ;
103
107
set. extend ( self . clauses . iter ( ) . cloned ( ) ) ;
@@ -391,10 +395,10 @@ pub struct TraitRef {
391
395
pub parameters : Vec < Parameter > ,
392
396
}
393
397
394
- #[ derive( Clone , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
395
398
/// A "domain goal" is a goal that is directly about Rust, rather than a pure
396
399
/// logical statement. As much as possible, the Chalk solver should avoid
397
400
/// decomposing this enum, and instead treat its values opaquely.
401
+ #[ derive( Clone , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
398
402
pub enum DomainGoal {
399
403
Implemented ( TraitRef ) ,
400
404
/// Is the projection something we know definitively from impls?
@@ -547,21 +551,21 @@ pub enum QuantifierKind {
547
551
ForAll , Exists
548
552
}
549
553
550
- #[ derive( Clone , Debug , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
551
554
/// A constraint on lifetimes.
552
555
///
553
556
/// When we search for solutions within the trait system, we essentially ignore
554
557
/// lifetime constraints, instead gathering them up to return with our solution
555
558
/// for later checking. This allows for decoupling between type and region
556
559
/// checking in the compiler.
560
+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
557
561
pub enum Constraint {
558
562
LifetimeEq ( Lifetime , Lifetime ) ,
559
563
}
560
564
561
565
/// A mapping of inference variables to instantiations thereof.
562
- // Uses BTreeMap for extracting in order (mostly for debugging/testing)
563
566
#[ derive( Clone , Debug , PartialEq , Eq ) ]
564
567
pub struct Substitution {
568
+ // Use BTreeMap for extracting in order (mostly for debugging/testing)
565
569
pub tys : BTreeMap < TyInferenceVariable , Ty > ,
566
570
pub lifetimes : BTreeMap < LifetimeInferenceVariable , Lifetime > ,
567
571
}
0 commit comments