@@ -363,10 +363,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
363
363
}
364
364
365
365
fn visit_free_region_map ( & mut self ) {
366
- let free_region_map = self . tcx ( )
367
- . lift_to_global ( & self . fcx . tables . borrow ( ) . free_region_map ) ;
368
- let free_region_map = free_region_map. expect ( "all regions in free-region-map are global" ) ;
369
- self . tables . free_region_map = free_region_map;
366
+ self . tables . free_region_map = self . fcx . tables . borrow ( ) . free_region_map . clone ( ) ;
367
+ debug_assert ! ( !self . tables. free_region_map. elements( ) . any( |r| r. has_local_value( ) ) ) ;
370
368
}
371
369
372
370
fn visit_user_provided_tys ( & mut self ) {
@@ -381,12 +379,10 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
381
379
local_id,
382
380
} ;
383
381
384
- let c_ty = if let Some ( c_ty) = self . tcx ( ) . lift_to_global ( c_ty) {
385
- c_ty
386
- } else {
382
+ if cfg ! ( debug_assertions) && c_ty. has_local_value ( ) {
387
383
span_bug ! (
388
384
hir_id. to_span( self . fcx. tcx) ,
389
- "writeback: `{:?}` missing from the global type context " ,
385
+ "writeback: `{:?}` is a local value " ,
390
386
c_ty
391
387
) ;
392
388
} ;
@@ -423,12 +419,10 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
423
419
debug_assert_eq ! ( fcx_tables. local_id_root, self . tables. local_id_root) ;
424
420
425
421
for ( & def_id, c_sig) in fcx_tables. user_provided_sigs . iter ( ) {
426
- let c_sig = if let Some ( c_sig) = self . tcx ( ) . lift_to_global ( c_sig) {
427
- c_sig
428
- } else {
422
+ if cfg ! ( debug_assertions) && c_sig. has_local_value ( ) {
429
423
span_bug ! (
430
424
self . fcx. tcx. hir( ) . span_if_local( def_id) . unwrap( ) ,
431
- "writeback: `{:?}` missing from the global type context " ,
425
+ "writeback: `{:?}` is a local value " ,
432
426
c_sig
433
427
) ;
434
428
} ;
@@ -743,20 +737,19 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
743
737
}
744
738
}
745
739
746
- fn resolve < T > ( & self , x : & T , span : & dyn Locatable ) -> T :: Lifted
740
+ fn resolve < T > ( & self , x : & T , span : & dyn Locatable ) -> T
747
741
where
748
- T : TypeFoldable < ' tcx > + ty :: Lift < ' tcx > ,
742
+ T : TypeFoldable < ' tcx > ,
749
743
{
750
744
let x = x. fold_with ( & mut Resolver :: new ( self . fcx , span, self . body ) ) ;
751
- if let Some ( lifted) = self . tcx ( ) . lift_to_global ( & x) {
752
- lifted
753
- } else {
745
+ if cfg ! ( debug_assertions) && x. has_local_value ( ) {
754
746
span_bug ! (
755
747
span. to_span( self . fcx. tcx) ,
756
- "writeback: `{:?}` missing from the global type context " ,
748
+ "writeback: `{:?}` is a local value " ,
757
749
x
758
750
) ;
759
751
}
752
+ x
760
753
}
761
754
}
762
755
0 commit comments