@@ -278,6 +278,8 @@ pub type TraitObligations<'tcx> = Vec<TraitObligation<'tcx>>;
278278/// * `DomainGoal`
279279/// * `Goal`
280280/// * `Clause`
281+ /// * `Environment`
282+ /// * `InEnvironment`
281283/// are used for representing the trait system in the form of
282284/// logic programming clauses. They are part of the interface
283285/// for the chalk SLG solver.
@@ -378,6 +380,33 @@ pub struct ProgramClause<'tcx> {
378380 pub hypotheses : Goals < ' tcx > ,
379381}
380382
383+ /// A set of clauses that we assume to be true.
384+ #[ derive( Copy , Clone , PartialEq , Eq , Hash , Debug ) ]
385+ pub struct Environment < ' tcx > {
386+ pub clauses : Clauses < ' tcx > ,
387+ }
388+
389+ impl Environment < ' tcx > {
390+ pub fn with < G > ( self , goal : G ) -> InEnvironment < ' tcx , G > {
391+ InEnvironment {
392+ environment : self ,
393+ goal,
394+ }
395+ }
396+ }
397+
398+ /// Something (usually a goal), along with an environment.
399+ #[ derive( Copy , Clone , PartialEq , Eq , Hash , Debug ) ]
400+ pub struct InEnvironment < ' tcx , G > {
401+ pub environment : Environment < ' tcx > ,
402+ pub goal : G ,
403+ }
404+
405+ /// Compute the environment of the given item.
406+ fn environment < ' a , ' tcx > ( _tcx : TyCtxt < ' a , ' tcx , ' tcx > , _def_id : DefId ) -> Environment < ' tcx > {
407+ panic ! ( )
408+ }
409+
381410pub type Selection < ' tcx > = Vtable < ' tcx , PredicateObligation < ' tcx > > ;
382411
383412#[ derive( Clone , Debug ) ]
@@ -1080,6 +1109,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
10801109 codegen_fulfill_obligation : codegen:: codegen_fulfill_obligation,
10811110 vtable_methods,
10821111 substitute_normalize_and_test_predicates,
1112+ environment,
10831113 ..* providers
10841114 } ;
10851115}
0 commit comments