@@ -14,7 +14,7 @@ use borrow_check::nll::type_check::constraint_conversion;
1414use borrow_check:: nll:: type_check:: { Locations , MirTypeckRegionConstraints } ;
1515use borrow_check:: nll:: universal_regions:: UniversalRegions ;
1616use borrow_check:: nll:: ToRegionVid ;
17- use rustc:: hir :: def_id :: DefId ;
17+ use rustc:: infer :: canonical :: QueryRegionConstraint ;
1818use rustc:: infer:: outlives:: free_region_map:: FreeRegionRelations ;
1919use rustc:: infer:: region_constraints:: GenericKind ;
2020use rustc:: infer:: InferCtxt ;
@@ -23,7 +23,6 @@ use rustc::traits::query::type_op::{self, TypeOp};
2323use rustc:: ty:: { self , RegionVid , Ty } ;
2424use rustc_data_structures:: transitive_relation:: TransitiveRelation ;
2525use std:: rc:: Rc ;
26- use syntax:: ast;
2726
2827#[ derive( Debug ) ]
2928crate struct UniversalRegionRelations < ' tcx > {
@@ -67,19 +66,15 @@ crate struct CreateResult<'tcx> {
6766
6867crate fn create (
6968 infcx : & InferCtxt < ' _ , ' _ , ' tcx > ,
70- mir_def_id : DefId ,
7169 param_env : ty:: ParamEnv < ' tcx > ,
7270 location_table : & LocationTable ,
7371 implicit_region_bound : Option < ty:: Region < ' tcx > > ,
7472 universal_regions : & Rc < UniversalRegions < ' tcx > > ,
7573 constraints : & mut MirTypeckRegionConstraints < ' tcx > ,
7674 all_facts : & mut Option < AllFacts > ,
7775) -> CreateResult < ' tcx > {
78- let mir_node_id = infcx. tcx . hir . as_local_node_id ( mir_def_id) . unwrap ( ) ;
7976 UniversalRegionRelationsBuilder {
8077 infcx,
81- mir_def_id,
82- mir_node_id,
8378 param_env,
8479 implicit_region_bound,
8580 constraints,
@@ -212,8 +207,6 @@ impl UniversalRegionRelations<'tcx> {
212207
213208struct UniversalRegionRelationsBuilder < ' this , ' gcx : ' tcx , ' tcx : ' this > {
214209 infcx : & ' this InferCtxt < ' this , ' gcx , ' tcx > ,
215- mir_def_id : DefId ,
216- mir_node_id : ast:: NodeId ,
217210 param_env : ty:: ParamEnv < ' tcx > ,
218211 location_table : & ' this LocationTable ,
219212 universal_regions : Rc < UniversalRegions < ' tcx > > ,
@@ -248,14 +241,16 @@ impl UniversalRegionRelationsBuilder<'cx, 'gcx, 'tcx> {
248241 let constraint_sets: Vec < _ > = unnormalized_input_output_tys
249242 . flat_map ( |ty| {
250243 debug ! ( "build: input_or_output={:?}" , ty) ;
251- let ( ty, constraints ) = self
244+ let ( ty, constraints1 ) = self
252245 . param_env
253246 . and ( type_op:: normalize:: Normalize :: new ( ty) )
254247 . fully_perform ( self . infcx )
255248 . unwrap_or_else ( |_| bug ! ( "failed to normalize {:?}" , ty) ) ;
256- self . add_implied_bounds ( ty) ;
249+ let constraints2 = self . add_implied_bounds ( ty) ;
257250 normalized_inputs_and_output. push ( ty) ;
258- constraints
251+ constraints1
252+ . into_iter ( )
253+ . chain ( constraints2)
259254 } )
260255 . collect ( ) ;
261256
@@ -306,13 +301,15 @@ impl UniversalRegionRelationsBuilder<'cx, 'gcx, 'tcx> {
306301 /// either the return type of the MIR or one of its arguments. At
307302 /// the same time, compute and add any implied bounds that come
308303 /// from this local.
309- fn add_implied_bounds ( & mut self , ty : Ty < ' tcx > ) {
304+ fn add_implied_bounds ( & mut self , ty : Ty < ' tcx > ) -> Option < Rc < Vec < QueryRegionConstraint < ' tcx > > > > {
310305 debug ! ( "add_implied_bounds(ty={:?})" , ty) ;
311- let span = self . infcx . tcx . def_span ( self . mir_def_id ) ;
312- let bounds = self
313- . infcx
314- . implied_outlives_bounds ( self . param_env , self . mir_node_id , ty, span) ;
306+ let ( bounds, constraints) =
307+ self . param_env
308+ . and ( type_op:: implied_outlives_bounds:: ImpliedOutlivesBounds { ty } )
309+ . fully_perform ( self . infcx )
310+ . unwrap_or_else ( |_| bug ! ( "failed to compute implied bounds {:?}" , ty) ) ;
315311 self . add_outlives_bounds ( bounds) ;
312+ constraints
316313 }
317314
318315 /// Registers the `OutlivesBound` items from `outlives_bounds` in
0 commit comments