File tree 1 file changed +5
-1
lines changed
compiler/rustc_middle/src/ty
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 {
1655
1655
type Lifted = $lifted;
1656
1656
fn lift_to_tcx( self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
1657
1657
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`.
1658
1660
Some ( unsafe { mem:: transmute( self ) } )
1659
1661
} else {
1660
1662
None
@@ -1674,7 +1676,9 @@ impl<'a, 'tcx> Lift<'tcx> for &'a List<Ty<'a>> {
1674
1676
return Some ( List :: empty ( ) ) ;
1675
1677
}
1676
1678
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 ) } )
1678
1682
} else {
1679
1683
None
1680
1684
}
You can’t perform that action at this time.
0 commit comments