File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1655,6 +1655,8 @@ macro_rules! nop_lift {
16551655 type Lifted = $lifted;
16561656 fn lift_to_tcx( self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
16571657 if tcx. interners. $set. contains_pointer_to( & InternedInSet ( self . 0.0 ) ) {
1658+ // SAFETY: `self` is interned and therefore valid
1659+ // for the entire lifetime of the `TyCtxt`.
16581660 Some ( unsafe { mem:: transmute( self ) } )
16591661 } else {
16601662 None
@@ -1674,7 +1676,9 @@ impl<'a, 'tcx> Lift<'tcx> for &'a List<Ty<'a>> {
16741676 return Some ( List :: empty ( ) ) ;
16751677 }
16761678 if tcx. interners . substs . contains_pointer_to ( & InternedInSet ( self . as_substs ( ) ) ) {
1677- Some ( unsafe { mem:: transmute ( self ) } )
1679+ // SAFETY: `self` is interned and therefore valid
1680+ // for the entire lifetime of the `TyCtxt`.
1681+ Some ( unsafe { mem:: transmute :: < & ' a List < Ty < ' a > > , & ' tcx List < Ty < ' tcx > > > ( self ) } )
16781682 } else {
16791683 None
16801684 }
You can’t perform that action at this time.
0 commit comments