@@ -46,6 +46,7 @@ use rustc::hir;
46
46
struct Env < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
47
47
infcx : & ' a infer:: InferCtxt < ' a , ' gcx , ' tcx > ,
48
48
region_maps : & ' a mut RegionMaps ,
49
+ param_env : ty:: ParamEnv < ' tcx > ,
49
50
}
50
51
51
52
struct RH < ' a > {
@@ -153,9 +154,13 @@ fn test_env<F>(source_string: &str,
153
154
index,
154
155
"test_crate" ,
155
156
|tcx| {
156
- tcx. infer_ctxt ( ( ) , Reveal :: UserFacing ) . enter ( |infcx| {
157
+ tcx. infer_ctxt ( ( ) ) . enter ( |infcx| {
157
158
let mut region_maps = RegionMaps :: new ( ) ;
158
- body ( Env { infcx : & infcx, region_maps : & mut region_maps } ) ;
159
+ body ( Env {
160
+ infcx : & infcx,
161
+ region_maps : & mut region_maps,
162
+ param_env : ty:: ParamEnv :: empty ( Reveal :: UserFacing ) ,
163
+ } ) ;
159
164
let free_regions = FreeRegionMap :: new ( ) ;
160
165
let def_id = tcx. hir . local_def_id ( ast:: CRATE_NODE_ID ) ;
161
166
infcx. resolve_regions_and_report_errors ( def_id, & region_maps, & free_regions) ;
@@ -250,14 +255,14 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
250
255
}
251
256
252
257
pub fn make_subtype ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> bool {
253
- match self . infcx . sub_types ( true , & ObligationCause :: dummy ( ) , a, b) {
258
+ match self . infcx . at ( & ObligationCause :: dummy ( ) , self . param_env ) . sub ( a, b) {
254
259
Ok ( _) => true ,
255
260
Err ( ref e) => panic ! ( "Encountered error: {}" , e) ,
256
261
}
257
262
}
258
263
259
264
pub fn is_subtype ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> bool {
260
- self . infcx . can_sub_types ( a, b) . is_ok ( )
265
+ self . infcx . can_sub ( self . param_env , a, b) . is_ok ( )
261
266
}
262
267
263
268
pub fn assert_subtype ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) {
@@ -354,30 +359,23 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
354
359
self . tcx ( ) . types . isize )
355
360
}
356
361
357
- pub fn dummy_type_trace ( & self ) -> infer:: TypeTrace < ' tcx > {
358
- infer:: TypeTrace :: dummy ( self . tcx ( ) )
359
- }
360
-
361
- pub fn sub ( & self , t1 : Ty < ' tcx > , t2 : Ty < ' tcx > ) -> InferResult < ' tcx , Ty < ' tcx > > {
362
- let trace = self . dummy_type_trace ( ) ;
363
- self . infcx . sub ( true , trace, & t1, & t2)
362
+ pub fn sub ( & self , t1 : Ty < ' tcx > , t2 : Ty < ' tcx > ) -> InferResult < ' tcx , ( ) > {
363
+ self . infcx . at ( & ObligationCause :: dummy ( ) , self . param_env ) . sub ( t1, t2)
364
364
}
365
365
366
366
pub fn lub ( & self , t1 : Ty < ' tcx > , t2 : Ty < ' tcx > ) -> InferResult < ' tcx , Ty < ' tcx > > {
367
- let trace = self . dummy_type_trace ( ) ;
368
- self . infcx . lub ( true , trace, & t1, & t2)
367
+ self . infcx . at ( & ObligationCause :: dummy ( ) , self . param_env ) . lub ( t1, t2)
369
368
}
370
369
371
370
pub fn glb ( & self , t1 : Ty < ' tcx > , t2 : Ty < ' tcx > ) -> InferResult < ' tcx , Ty < ' tcx > > {
372
- let trace = self . dummy_type_trace ( ) ;
373
- self . infcx . glb ( true , trace, & t1, & t2)
371
+ self . infcx . at ( & ObligationCause :: dummy ( ) , self . param_env ) . glb ( t1, t2)
374
372
}
375
373
376
374
/// Checks that `t1 <: t2` is true (this may register additional
377
375
/// region checks).
378
376
pub fn check_sub ( & self , t1 : Ty < ' tcx > , t2 : Ty < ' tcx > ) {
379
377
match self . sub ( t1, t2) {
380
- Ok ( InferOk { obligations, .. } ) => {
378
+ Ok ( InferOk { obligations, value : ( ) } ) => {
381
379
// None of these tests should require nested obligations:
382
380
assert ! ( obligations. is_empty( ) ) ;
383
381
}
0 commit comments