File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed
rustc_next_trait_solver/src/solve Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -432,6 +432,13 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
432
432
self . explicit_implied_predicates_of ( def_id) . map_bound ( |preds| preds. into_iter ( ) . copied ( ) )
433
433
}
434
434
435
+ fn impl_super_outlives (
436
+ self ,
437
+ impl_def_id : DefId ,
438
+ ) -> ty:: EarlyBinder < ' tcx , impl IntoIterator < Item = ty:: Clause < ' tcx > > > {
439
+ self . impl_super_outlives ( impl_def_id)
440
+ }
441
+
435
442
fn impl_is_const ( self , def_id : DefId ) -> bool {
436
443
debug_assert_matches ! ( self . def_kind( def_id) , DefKind :: Impl { of_trait: true } ) ;
437
444
self . is_conditionally_const ( def_id)
Original file line number Diff line number Diff line change @@ -103,15 +103,12 @@ where
103
103
// We currently elaborate all supertrait outlives obligations from impls.
104
104
// This can be removed when we actually do coinduction correctly, and prove
105
105
// all supertrait obligations unconditionally.
106
- let goal_clause: I :: Clause = goal. predicate . upcast ( cx) ;
107
- for clause in elaborate:: elaborate ( cx, [ goal_clause] ) {
108
- if matches ! (
109
- clause. kind( ) . skip_binder( ) ,
110
- ty:: ClauseKind :: TypeOutlives ( ..) | ty:: ClauseKind :: RegionOutlives ( ..)
111
- ) {
112
- ecx. add_goal ( GoalSource :: Misc , goal. with ( cx, clause) ) ;
113
- }
114
- }
106
+ ecx. add_goals (
107
+ GoalSource :: Misc ,
108
+ cx. impl_super_outlives ( impl_def_id)
109
+ . iter_instantiated ( cx, impl_args)
110
+ . map ( |pred| goal. with ( cx, pred) ) ,
111
+ ) ;
115
112
116
113
ecx. evaluate_added_goals_and_make_canonical_response ( maximal_certainty)
117
114
} )
Original file line number Diff line number Diff line change @@ -271,6 +271,13 @@ pub trait Interner:
271
271
def_id : Self :: DefId ,
272
272
) -> ty:: EarlyBinder < Self , impl IntoIterator < Item = ( Self :: Clause , Self :: Span ) > > ;
273
273
274
+ /// This is equivalent to computing the super-predicates of the trait for this impl
275
+ /// and filtering them to the outlives predicates. This is purely for performance.
276
+ fn impl_super_outlives (
277
+ self ,
278
+ impl_def_id : Self :: DefId ,
279
+ ) -> ty:: EarlyBinder < Self , impl IntoIterator < Item = Self :: Clause > > ;
280
+
274
281
fn impl_is_const ( self , def_id : Self :: DefId ) -> bool ;
275
282
fn fn_is_const ( self , def_id : Self :: DefId ) -> bool ;
276
283
fn alias_has_const_conditions ( self , def_id : Self :: DefId ) -> bool ;
You can’t perform that action at this time.
0 commit comments