@@ -53,7 +53,7 @@ use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet};
5353use arena:: SyncDroplessArena ;
5454use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
5555use rustc_data_structures:: profiling:: SelfProfilerRef ;
56- use rustc_data_structures:: sharded:: ShardedHashMap ;
56+ use rustc_data_structures:: sharded:: { IntoPointer , ShardedHashMap } ;
5757use rustc_data_structures:: stable_hasher:: {
5858 hash_stable_hashmap, HashStable , StableHasher , StableVec ,
5959} ;
@@ -1560,11 +1560,11 @@ pub trait Lift<'tcx>: fmt::Debug {
15601560}
15611561
15621562macro_rules! nop_lift {
1563- ( $ty: ty => $lifted: ty) => {
1563+ ( $set : ident ; $ ty: ty => $lifted: ty) => {
15641564 impl <' a, ' tcx> Lift <' tcx> for $ty {
15651565 type Lifted = $lifted;
15661566 fn lift_to_tcx( & self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
1567- if tcx. interners. arena . in_arena ( * self as * const _ ) {
1567+ if tcx. interners. $set . contains_pointer_to ( & Interned ( * self ) ) {
15681568 Some ( unsafe { mem:: transmute( * self ) } )
15691569 } else {
15701570 None
@@ -1575,14 +1575,14 @@ macro_rules! nop_lift {
15751575}
15761576
15771577macro_rules! nop_list_lift {
1578- ( $ty: ty => $lifted: ty) => {
1578+ ( $set : ident ; $ ty: ty => $lifted: ty) => {
15791579 impl <' a, ' tcx> Lift <' tcx> for & ' a List <$ty> {
15801580 type Lifted = & ' tcx List <$lifted>;
15811581 fn lift_to_tcx( & self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
15821582 if self . is_empty( ) {
15831583 return Some ( List :: empty( ) ) ;
15841584 }
1585- if tcx. interners. arena . in_arena ( * self as * const _ ) {
1585+ if tcx. interners. $set . contains_pointer_to ( & Interned ( * self ) ) {
15861586 Some ( unsafe { mem:: transmute( * self ) } )
15871587 } else {
15881588 None
@@ -1592,21 +1592,21 @@ macro_rules! nop_list_lift {
15921592 } ;
15931593}
15941594
1595- nop_lift ! { Ty <' a> => Ty <' tcx>}
1596- nop_lift ! { Region <' a> => Region <' tcx>}
1597- nop_lift ! { Goal <' a> => Goal <' tcx>}
1598- nop_lift ! { & ' a Const <' a> => & ' tcx Const <' tcx>}
1595+ nop_lift ! { type_ ; Ty <' a> => Ty <' tcx>}
1596+ nop_lift ! { region ; Region <' a> => Region <' tcx>}
1597+ nop_lift ! { goal ; Goal <' a> => Goal <' tcx>}
1598+ nop_lift ! { const_ ; & ' a Const <' a> => & ' tcx Const <' tcx>}
15991599
1600- nop_list_lift ! { Goal <' a> => Goal <' tcx>}
1601- nop_list_lift ! { Clause <' a> => Clause <' tcx>}
1602- nop_list_lift ! { Ty <' a> => Ty <' tcx>}
1603- nop_list_lift ! { ExistentialPredicate <' a> => ExistentialPredicate <' tcx>}
1604- nop_list_lift ! { Predicate <' a> => Predicate <' tcx>}
1605- nop_list_lift ! { CanonicalVarInfo => CanonicalVarInfo }
1606- nop_list_lift ! { ProjectionKind => ProjectionKind }
1600+ nop_list_lift ! { goal_list ; Goal <' a> => Goal <' tcx>}
1601+ nop_list_lift ! { clauses ; Clause <' a> => Clause <' tcx>}
1602+ nop_list_lift ! { type_list ; Ty <' a> => Ty <' tcx>}
1603+ nop_list_lift ! { existential_predicates ; ExistentialPredicate <' a> => ExistentialPredicate <' tcx>}
1604+ nop_list_lift ! { predicates ; Predicate <' a> => Predicate <' tcx>}
1605+ nop_list_lift ! { canonical_var_infos ; CanonicalVarInfo => CanonicalVarInfo }
1606+ nop_list_lift ! { projs ; ProjectionKind => ProjectionKind }
16071607
16081608// This is the impl for `&'a InternalSubsts<'a>`.
1609- nop_list_lift ! { GenericArg <' a> => GenericArg <' tcx>}
1609+ nop_list_lift ! { substs ; GenericArg <' a> => GenericArg <' tcx>}
16101610
16111611pub mod tls {
16121612 use super :: { ptr_eq, GlobalCtxt , TyCtxt } ;
@@ -1930,6 +1930,11 @@ impl<'tcx, T: 'tcx + ?Sized> Clone for Interned<'tcx, T> {
19301930}
19311931impl < ' tcx , T : ' tcx + ?Sized > Copy for Interned < ' tcx , T > { }
19321932
1933+ impl < ' tcx , T : ' tcx + ?Sized > IntoPointer for Interned < ' tcx , T > {
1934+ fn into_pointer ( & self ) -> * const ( ) {
1935+ self . 0 as * const _ as * const ( )
1936+ }
1937+ }
19331938// N.B., an `Interned<Ty>` compares and hashes as a `TyKind`.
19341939impl < ' tcx > PartialEq for Interned < ' tcx , TyS < ' tcx > > {
19351940 fn eq ( & self , other : & Interned < ' tcx , TyS < ' tcx > > ) -> bool {
0 commit comments