@@ -15,7 +15,9 @@ use borrow_check::borrow_set::BorrowSet;
1515use borrow_check:: location:: LocationTable ;
1616use borrow_check:: nll:: constraints:: { ConstraintCategory , ConstraintSet , OutlivesConstraint } ;
1717use borrow_check:: nll:: facts:: AllFacts ;
18- use borrow_check:: nll:: region_infer:: values:: { LivenessValues , RegionValueElements } ;
18+ use borrow_check:: nll:: region_infer:: values:: LivenessValues ;
19+ use borrow_check:: nll:: region_infer:: values:: PlaceholderIndices ;
20+ use borrow_check:: nll:: region_infer:: values:: RegionValueElements ;
1921use borrow_check:: nll:: region_infer:: { ClosureRegionRequirementsExt , TypeTest } ;
2022use borrow_check:: nll:: renumber;
2123use borrow_check:: nll:: type_check:: free_region_relations:: {
@@ -42,13 +44,13 @@ use rustc::traits::{ObligationCause, PredicateObligations};
4244use rustc:: ty:: fold:: TypeFoldable ;
4345use rustc:: ty:: subst:: Subst ;
4446use rustc:: ty:: { self , CanonicalTy , RegionVid , ToPolyTraitRef , Ty , TyCtxt , TyKind } ;
45- use std:: { fmt, iter} ;
4647use std:: rc:: Rc ;
48+ use std:: { fmt, iter} ;
4749use syntax_pos:: { Span , DUMMY_SP } ;
4850use transform:: { MirPass , MirSource } ;
4951
50- use rustc_data_structures:: fx:: FxHashSet ;
5152use either:: Either ;
53+ use rustc_data_structures:: fx:: FxHashSet ;
5254
5355macro_rules! span_mirbug {
5456 ( $context: expr, $elem: expr, $( $message: tt) * ) => ( {
@@ -128,6 +130,7 @@ pub(crate) fn type_check<'gcx, 'tcx>(
128130 outlives_constraints : ConstraintSet :: default ( ) ,
129131 type_tests : Vec :: default ( ) ,
130132 } ;
133+ let mut placeholder_indices = PlaceholderIndices :: default ( ) ;
131134
132135 let CreateResult {
133136 universal_region_relations,
@@ -147,6 +150,7 @@ pub(crate) fn type_check<'gcx, 'tcx>(
147150 borrow_set,
148151 all_facts,
149152 constraints : & mut constraints,
153+ placeholder_indices : & mut placeholder_indices,
150154 } ;
151155
152156 type_check_internal (
@@ -162,12 +166,15 @@ pub(crate) fn type_check<'gcx, 'tcx>(
162166 cx. equate_inputs_and_outputs ( mir, universal_regions, & normalized_inputs_and_output) ;
163167 liveness:: generate ( cx, mir, elements, flow_inits, move_data, location_table) ;
164168
165- cx. borrowck_context . as_mut ( ) . map ( |bcx| translate_outlives_facts ( bcx) ) ;
169+ cx. borrowck_context
170+ . as_mut ( )
171+ . map ( |bcx| translate_outlives_facts ( bcx) ) ;
166172 } ,
167173 ) ;
168174
169175 MirTypeckResults {
170176 constraints,
177+ placeholder_indices,
171178 universal_region_relations,
172179 }
173180}
@@ -210,21 +217,25 @@ fn type_check_internal<'a, 'gcx, 'tcx, R>(
210217fn translate_outlives_facts ( cx : & mut BorrowCheckContext ) {
211218 if let Some ( facts) = cx. all_facts {
212219 let location_table = cx. location_table ;
213- facts. outlives . extend (
214- cx. constraints . outlives_constraints . iter ( ) . flat_map ( |constraint : & OutlivesConstraint | {
215- if let Some ( from_location) = constraint. locations . from_location ( ) {
216- Either :: Left ( iter:: once ( (
217- constraint. sup ,
218- constraint. sub ,
219- location_table. mid_index ( from_location) ,
220- ) ) )
221- } else {
222- Either :: Right ( location_table. all_points ( ) . map ( move |location| {
223- ( constraint. sup , constraint. sub , location)
224- } ) )
225- }
226- } )
227- ) ;
220+ facts
221+ . outlives
222+ . extend ( cx. constraints . outlives_constraints . iter ( ) . flat_map (
223+ |constraint : & OutlivesConstraint | {
224+ if let Some ( from_location) = constraint. locations . from_location ( ) {
225+ Either :: Left ( iter:: once ( (
226+ constraint. sup ,
227+ constraint. sub ,
228+ location_table. mid_index ( from_location) ,
229+ ) ) )
230+ } else {
231+ Either :: Right (
232+ location_table
233+ . all_points ( )
234+ . map ( move |location| ( constraint. sup , constraint. sub , location) ) ,
235+ )
236+ }
237+ } ,
238+ ) ) ;
228239 }
229240}
230241
@@ -718,10 +729,12 @@ struct BorrowCheckContext<'a, 'tcx: 'a> {
718729 all_facts : & ' a mut Option < AllFacts > ,
719730 borrow_set : & ' a BorrowSet < ' tcx > ,
720731 constraints : & ' a mut MirTypeckRegionConstraints < ' tcx > ,
732+ placeholder_indices : & ' a mut PlaceholderIndices ,
721733}
722734
723735crate struct MirTypeckResults < ' tcx > {
724736 crate constraints : MirTypeckRegionConstraints < ' tcx > ,
737+ crate placeholder_indices : PlaceholderIndices ,
725738 crate universal_region_relations : Rc < UniversalRegionRelations < ' tcx > > ,
726739}
727740
0 commit comments