@@ -363,10 +363,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
363363 }
364364
365365 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( ) ) ) ;
370368 }
371369
372370 fn visit_user_provided_tys ( & mut self ) {
@@ -381,12 +379,10 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
381379 local_id,
382380 } ;
383381
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 ( ) {
387383 span_bug ! (
388384 hir_id. to_span( self . fcx. tcx) ,
389- "writeback: `{:?}` missing from the global type context " ,
385+ "writeback: `{:?}` is a local value " ,
390386 c_ty
391387 ) ;
392388 } ;
@@ -423,12 +419,10 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
423419 debug_assert_eq ! ( fcx_tables. local_id_root, self . tables. local_id_root) ;
424420
425421 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 ( ) {
429423 span_bug ! (
430424 self . fcx. tcx. hir( ) . span_if_local( def_id) . unwrap( ) ,
431- "writeback: `{:?}` missing from the global type context " ,
425+ "writeback: `{:?}` is a local value " ,
432426 c_sig
433427 ) ;
434428 } ;
@@ -743,20 +737,19 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
743737 }
744738 }
745739
746- fn resolve < T > ( & self , x : & T , span : & dyn Locatable ) -> T :: Lifted
740+ fn resolve < T > ( & self , x : & T , span : & dyn Locatable ) -> T
747741 where
748- T : TypeFoldable < ' tcx > + ty :: Lift < ' tcx > ,
742+ T : TypeFoldable < ' tcx > ,
749743 {
750744 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 ( ) {
754746 span_bug ! (
755747 span. to_span( self . fcx. tcx) ,
756- "writeback: `{:?}` missing from the global type context " ,
748+ "writeback: `{:?}` is a local value " ,
757749 x
758750 ) ;
759751 }
752+ x
760753 }
761754}
762755
0 commit comments