@@ -46,6 +46,7 @@ use rustc::hir;
4646struct Env < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
4747 infcx : & ' a infer:: InferCtxt < ' a , ' gcx , ' tcx > ,
4848 region_maps : & ' a mut RegionMaps ,
49+ param_env : ty:: ParamEnv < ' tcx > ,
4950}
5051
5152struct RH < ' a > {
@@ -153,9 +154,13 @@ fn test_env<F>(source_string: &str,
153154 index,
154155 "test_crate" ,
155156 |tcx| {
156- tcx. infer_ctxt ( ( ) , Reveal :: UserFacing ) . enter ( |infcx| {
157+ tcx. infer_ctxt ( ( ) ) . enter ( |infcx| {
157158 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+ } ) ;
159164 let free_regions = FreeRegionMap :: new ( ) ;
160165 let def_id = tcx. hir . local_def_id ( ast:: CRATE_NODE_ID ) ;
161166 infcx. resolve_regions_and_report_errors ( def_id, & region_maps, & free_regions) ;
@@ -250,14 +255,14 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
250255 }
251256
252257 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) {
254259 Ok ( _) => true ,
255260 Err ( ref e) => panic ! ( "Encountered error: {}" , e) ,
256261 }
257262 }
258263
259264 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 ( )
261266 }
262267
263268 pub fn assert_subtype ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) {
@@ -354,30 +359,23 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
354359 self . tcx ( ) . types . isize )
355360 }
356361
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)
364364 }
365365
366366 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)
369368 }
370369
371370 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)
374372 }
375373
376374 /// Checks that `t1 <: t2` is true (this may register additional
377375 /// region checks).
378376 pub fn check_sub ( & self , t1 : Ty < ' tcx > , t2 : Ty < ' tcx > ) {
379377 match self . sub ( t1, t2) {
380- Ok ( InferOk { obligations, .. } ) => {
378+ Ok ( InferOk { obligations, value : ( ) } ) => {
381379 // None of these tests should require nested obligations:
382380 assert ! ( obligations. is_empty( ) ) ;
383381 }
0 commit comments