@@ -14,7 +14,7 @@ use borrow_check::nll::type_check::constraint_conversion;
14
14
use borrow_check:: nll:: type_check:: { Locations , MirTypeckRegionConstraints } ;
15
15
use borrow_check:: nll:: universal_regions:: UniversalRegions ;
16
16
use borrow_check:: nll:: ToRegionVid ;
17
- use rustc:: hir :: def_id :: DefId ;
17
+ use rustc:: infer :: canonical :: QueryRegionConstraint ;
18
18
use rustc:: infer:: outlives:: free_region_map:: FreeRegionRelations ;
19
19
use rustc:: infer:: region_constraints:: GenericKind ;
20
20
use rustc:: infer:: InferCtxt ;
@@ -23,7 +23,6 @@ use rustc::traits::query::type_op::{self, TypeOp};
23
23
use rustc:: ty:: { self , RegionVid , Ty } ;
24
24
use rustc_data_structures:: transitive_relation:: TransitiveRelation ;
25
25
use std:: rc:: Rc ;
26
- use syntax:: ast;
27
26
28
27
#[ derive( Debug ) ]
29
28
crate struct UniversalRegionRelations < ' tcx > {
@@ -67,19 +66,15 @@ crate struct CreateResult<'tcx> {
67
66
68
67
crate fn create (
69
68
infcx : & InferCtxt < ' _ , ' _ , ' tcx > ,
70
- mir_def_id : DefId ,
71
69
param_env : ty:: ParamEnv < ' tcx > ,
72
70
location_table : & LocationTable ,
73
71
implicit_region_bound : Option < ty:: Region < ' tcx > > ,
74
72
universal_regions : & Rc < UniversalRegions < ' tcx > > ,
75
73
constraints : & mut MirTypeckRegionConstraints < ' tcx > ,
76
74
all_facts : & mut Option < AllFacts > ,
77
75
) -> CreateResult < ' tcx > {
78
- let mir_node_id = infcx. tcx . hir . as_local_node_id ( mir_def_id) . unwrap ( ) ;
79
76
UniversalRegionRelationsBuilder {
80
77
infcx,
81
- mir_def_id,
82
- mir_node_id,
83
78
param_env,
84
79
implicit_region_bound,
85
80
constraints,
@@ -212,8 +207,6 @@ impl UniversalRegionRelations<'tcx> {
212
207
213
208
struct UniversalRegionRelationsBuilder < ' this , ' gcx : ' tcx , ' tcx : ' this > {
214
209
infcx : & ' this InferCtxt < ' this , ' gcx , ' tcx > ,
215
- mir_def_id : DefId ,
216
- mir_node_id : ast:: NodeId ,
217
210
param_env : ty:: ParamEnv < ' tcx > ,
218
211
location_table : & ' this LocationTable ,
219
212
universal_regions : Rc < UniversalRegions < ' tcx > > ,
@@ -248,14 +241,16 @@ impl UniversalRegionRelationsBuilder<'cx, 'gcx, 'tcx> {
248
241
let constraint_sets: Vec < _ > = unnormalized_input_output_tys
249
242
. flat_map ( |ty| {
250
243
debug ! ( "build: input_or_output={:?}" , ty) ;
251
- let ( ty, constraints ) = self
244
+ let ( ty, constraints1 ) = self
252
245
. param_env
253
246
. and ( type_op:: normalize:: Normalize :: new ( ty) )
254
247
. fully_perform ( self . infcx )
255
248
. unwrap_or_else ( |_| bug ! ( "failed to normalize {:?}" , ty) ) ;
256
- self . add_implied_bounds ( ty) ;
249
+ let constraints2 = self . add_implied_bounds ( ty) ;
257
250
normalized_inputs_and_output. push ( ty) ;
258
- constraints
251
+ constraints1
252
+ . into_iter ( )
253
+ . chain ( constraints2)
259
254
} )
260
255
. collect ( ) ;
261
256
@@ -306,13 +301,15 @@ impl UniversalRegionRelationsBuilder<'cx, 'gcx, 'tcx> {
306
301
/// either the return type of the MIR or one of its arguments. At
307
302
/// the same time, compute and add any implied bounds that come
308
303
/// 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 > > > > {
310
305
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) ) ;
315
311
self . add_outlives_bounds ( bounds) ;
312
+ constraints
316
313
}
317
314
318
315
/// Registers the `OutlivesBound` items from `outlives_bounds` in
0 commit comments