@@ -91,7 +91,7 @@ pub trait OnDiskCache<'tcx>: rustc_data_structures::sync::Sync {
91
91
#[ derive( TyEncodable , TyDecodable , HashStable ) ]
92
92
pub struct DelaySpanBugEmitted ( ( ) ) ;
93
93
94
- type InternedSet < ' tcx , T > = ShardedHashMap < Interned < ' tcx , T > , ( ) > ;
94
+ type InternedSet < ' tcx , T > = ShardedHashMap < InternedInSet < ' tcx , T > , ( ) > ;
95
95
96
96
pub struct CtxtInterners < ' tcx > {
97
97
/// The arena that types, regions, etc. are allocated from.
@@ -161,7 +161,7 @@ impl<'tcx> CtxtInterners<'tcx> {
161
161
outer_exclusive_binder : flags. outer_exclusive_binder ,
162
162
} ;
163
163
164
- Interned ( self . arena . alloc ( ty_struct) )
164
+ InternedInSet ( self . arena . alloc ( ty_struct) )
165
165
} )
166
166
. 0
167
167
}
@@ -181,7 +181,7 @@ impl<'tcx> CtxtInterners<'tcx> {
181
181
outer_exclusive_binder : flags. outer_exclusive_binder ,
182
182
} ;
183
183
184
- Interned ( self . arena . alloc ( predicate_struct) )
184
+ InternedInSet ( self . arena . alloc ( predicate_struct) )
185
185
} )
186
186
. 0
187
187
}
@@ -928,7 +928,7 @@ impl<'tcx> CommonTypes<'tcx> {
928
928
929
929
impl < ' tcx > CommonLifetimes < ' tcx > {
930
930
fn new ( interners : & CtxtInterners < ' tcx > ) -> CommonLifetimes < ' tcx > {
931
- let mk = |r| interners. region . intern ( r, |r| Interned ( interners. arena . alloc ( r) ) ) . 0 ;
931
+ let mk = |r| interners. region . intern ( r, |r| InternedInSet ( interners. arena . alloc ( r) ) ) . 0 ;
932
932
933
933
CommonLifetimes {
934
934
re_root_empty : mk ( RegionKind :: ReEmpty ( ty:: UniverseIndex :: ROOT ) ) ,
@@ -940,7 +940,8 @@ impl<'tcx> CommonLifetimes<'tcx> {
940
940
941
941
impl < ' tcx > CommonConsts < ' tcx > {
942
942
fn new ( interners : & CtxtInterners < ' tcx > , types : & CommonTypes < ' tcx > ) -> CommonConsts < ' tcx > {
943
- let mk_const = |c| interners. const_ . intern ( c, |c| Interned ( interners. arena . alloc ( c) ) ) . 0 ;
943
+ let mk_const =
944
+ |c| interners. const_ . intern ( c, |c| InternedInSet ( interners. arena . alloc ( c) ) ) . 0 ;
944
945
945
946
CommonConsts {
946
947
unit : mk_const ( ty:: Const {
@@ -1632,7 +1633,7 @@ macro_rules! nop_lift {
1632
1633
impl <' a, ' tcx> Lift <' tcx> for $ty {
1633
1634
type Lifted = $lifted;
1634
1635
fn lift_to_tcx( self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
1635
- if tcx. interners. $set. contains_pointer_to( & Interned ( self ) ) {
1636
+ if tcx. interners. $set. contains_pointer_to( & InternedInSet ( self ) ) {
1636
1637
Some ( unsafe { mem:: transmute( self ) } )
1637
1638
} else {
1638
1639
None
@@ -1650,7 +1651,7 @@ macro_rules! nop_list_lift {
1650
1651
if self . is_empty( ) {
1651
1652
return Some ( List :: empty( ) ) ;
1652
1653
}
1653
- if tcx. interners. $set. contains_pointer_to( & Interned ( self ) ) {
1654
+ if tcx. interners. $set. contains_pointer_to( & InternedInSet ( self ) ) {
1654
1655
Some ( unsafe { mem:: transmute( self ) } )
1655
1656
} else {
1656
1657
None
@@ -1857,7 +1858,7 @@ macro_rules! sty_debug_print {
1857
1858
#[ allow( non_snake_case) ]
1858
1859
mod inner {
1859
1860
use crate :: ty:: { self , TyCtxt } ;
1860
- use crate :: ty:: context:: Interned ;
1861
+ use crate :: ty:: context:: InternedInSet ;
1861
1862
1862
1863
#[ derive( Copy , Clone ) ]
1863
1864
struct DebugStat {
@@ -1880,7 +1881,7 @@ macro_rules! sty_debug_print {
1880
1881
1881
1882
let shards = tcx. interners. type_. lock_shards( ) ;
1882
1883
let types = shards. iter( ) . flat_map( |shard| shard. keys( ) ) ;
1883
- for & Interned ( t) in types {
1884
+ for & InternedInSet ( t) in types {
1884
1885
let variant = match t. kind( ) {
1885
1886
ty:: Bool | ty:: Char | ty:: Int ( ..) | ty:: Uint ( ..) |
1886
1887
ty:: Float ( ..) | ty:: Str | ty:: Never => continue ,
@@ -1980,86 +1981,86 @@ impl<'tcx> TyCtxt<'tcx> {
1980
1981
// this type just holds a pointer to it, but it still effectively owns it. It
1981
1982
// impls `Borrow` so that it can be looked up using the original
1982
1983
// (non-arena-memory-owning) types.
1983
- struct Interned < ' tcx , T : ?Sized > ( & ' tcx T ) ;
1984
+ struct InternedInSet < ' tcx , T : ?Sized > ( & ' tcx T ) ;
1984
1985
1985
- impl < ' tcx , T : ' tcx + ?Sized > Clone for Interned < ' tcx , T > {
1986
+ impl < ' tcx , T : ' tcx + ?Sized > Clone for InternedInSet < ' tcx , T > {
1986
1987
fn clone ( & self ) -> Self {
1987
- Interned ( self . 0 )
1988
+ InternedInSet ( self . 0 )
1988
1989
}
1989
1990
}
1990
1991
1991
- impl < ' tcx , T : ' tcx + ?Sized > Copy for Interned < ' tcx , T > { }
1992
+ impl < ' tcx , T : ' tcx + ?Sized > Copy for InternedInSet < ' tcx , T > { }
1992
1993
1993
- impl < ' tcx , T : ' tcx + ?Sized > IntoPointer for Interned < ' tcx , T > {
1994
+ impl < ' tcx , T : ' tcx + ?Sized > IntoPointer for InternedInSet < ' tcx , T > {
1994
1995
fn into_pointer ( & self ) -> * const ( ) {
1995
1996
self . 0 as * const _ as * const ( )
1996
1997
}
1997
1998
}
1998
1999
1999
2000
#[ allow( rustc:: usage_of_ty_tykind) ]
2000
- impl < ' tcx > Borrow < TyKind < ' tcx > > for Interned < ' tcx , TyS < ' tcx > > {
2001
+ impl < ' tcx > Borrow < TyKind < ' tcx > > for InternedInSet < ' tcx , TyS < ' tcx > > {
2001
2002
fn borrow < ' a > ( & ' a self ) -> & ' a TyKind < ' tcx > {
2002
2003
& self . 0 . kind ( )
2003
2004
}
2004
2005
}
2005
2006
2006
- impl < ' tcx > PartialEq for Interned < ' tcx , TyS < ' tcx > > {
2007
- fn eq ( & self , other : & Interned < ' tcx , TyS < ' tcx > > ) -> bool {
2007
+ impl < ' tcx > PartialEq for InternedInSet < ' tcx , TyS < ' tcx > > {
2008
+ fn eq ( & self , other : & InternedInSet < ' tcx , TyS < ' tcx > > ) -> bool {
2008
2009
// The `Borrow` trait requires that `x.borrow() == y.borrow()` equals
2009
2010
// `x == y`.
2010
2011
self . 0 . kind ( ) == other. 0 . kind ( )
2011
2012
}
2012
2013
}
2013
2014
2014
- impl < ' tcx > Eq for Interned < ' tcx , TyS < ' tcx > > { }
2015
+ impl < ' tcx > Eq for InternedInSet < ' tcx , TyS < ' tcx > > { }
2015
2016
2016
- impl < ' tcx > Hash for Interned < ' tcx , TyS < ' tcx > > {
2017
+ impl < ' tcx > Hash for InternedInSet < ' tcx , TyS < ' tcx > > {
2017
2018
fn hash < H : Hasher > ( & self , s : & mut H ) {
2018
2019
// The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`.
2019
2020
self . 0 . kind ( ) . hash ( s)
2020
2021
}
2021
2022
}
2022
2023
2023
- impl < ' tcx > Borrow < Binder < ' tcx , PredicateKind < ' tcx > > > for Interned < ' tcx , PredicateInner < ' tcx > > {
2024
+ impl < ' tcx > Borrow < Binder < ' tcx , PredicateKind < ' tcx > > > for InternedInSet < ' tcx , PredicateInner < ' tcx > > {
2024
2025
fn borrow < ' a > ( & ' a self ) -> & ' a Binder < ' tcx , PredicateKind < ' tcx > > {
2025
2026
& self . 0 . kind
2026
2027
}
2027
2028
}
2028
2029
2029
- impl < ' tcx > PartialEq for Interned < ' tcx , PredicateInner < ' tcx > > {
2030
- fn eq ( & self , other : & Interned < ' tcx , PredicateInner < ' tcx > > ) -> bool {
2030
+ impl < ' tcx > PartialEq for InternedInSet < ' tcx , PredicateInner < ' tcx > > {
2031
+ fn eq ( & self , other : & InternedInSet < ' tcx , PredicateInner < ' tcx > > ) -> bool {
2031
2032
// The `Borrow` trait requires that `x.borrow() == y.borrow()` equals
2032
2033
// `x == y`.
2033
2034
self . 0 . kind == other. 0 . kind
2034
2035
}
2035
2036
}
2036
2037
2037
- impl < ' tcx > Eq for Interned < ' tcx , PredicateInner < ' tcx > > { }
2038
+ impl < ' tcx > Eq for InternedInSet < ' tcx , PredicateInner < ' tcx > > { }
2038
2039
2039
- impl < ' tcx > Hash for Interned < ' tcx , PredicateInner < ' tcx > > {
2040
+ impl < ' tcx > Hash for InternedInSet < ' tcx , PredicateInner < ' tcx > > {
2040
2041
fn hash < H : Hasher > ( & self , s : & mut H ) {
2041
2042
// The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`.
2042
2043
self . 0 . kind . hash ( s)
2043
2044
}
2044
2045
}
2045
2046
2046
- impl < ' tcx , T > Borrow < [ T ] > for Interned < ' tcx , List < T > > {
2047
+ impl < ' tcx , T > Borrow < [ T ] > for InternedInSet < ' tcx , List < T > > {
2047
2048
fn borrow < ' a > ( & ' a self ) -> & ' a [ T ] {
2048
2049
& self . 0 [ ..]
2049
2050
}
2050
2051
}
2051
2052
2052
- impl < ' tcx , T : PartialEq > PartialEq for Interned < ' tcx , List < T > > {
2053
- fn eq ( & self , other : & Interned < ' tcx , List < T > > ) -> bool {
2053
+ impl < ' tcx , T : PartialEq > PartialEq for InternedInSet < ' tcx , List < T > > {
2054
+ fn eq ( & self , other : & InternedInSet < ' tcx , List < T > > ) -> bool {
2054
2055
// The `Borrow` trait requires that `x.borrow() == y.borrow()` equals
2055
2056
// `x == y`.
2056
2057
self . 0 [ ..] == other. 0 [ ..]
2057
2058
}
2058
2059
}
2059
2060
2060
- impl < ' tcx , T : Eq > Eq for Interned < ' tcx , List < T > > { }
2061
+ impl < ' tcx , T : Eq > Eq for InternedInSet < ' tcx , List < T > > { }
2061
2062
2062
- impl < ' tcx , T : Hash > Hash for Interned < ' tcx , List < T > > {
2063
+ impl < ' tcx , T : Hash > Hash for InternedInSet < ' tcx , List < T > > {
2063
2064
fn hash < H : Hasher > ( & self , s : & mut H ) {
2064
2065
// The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`.
2065
2066
self . 0 [ ..] . hash ( s)
@@ -2068,23 +2069,23 @@ impl<'tcx, T: Hash> Hash for Interned<'tcx, List<T>> {
2068
2069
2069
2070
macro_rules! direct_interners {
2070
2071
( $( $name: ident: $method: ident( $ty: ty) , ) +) => {
2071
- $( impl <' tcx> Borrow <$ty> for Interned <' tcx, $ty> {
2072
+ $( impl <' tcx> Borrow <$ty> for InternedInSet <' tcx, $ty> {
2072
2073
fn borrow<' a>( & ' a self ) -> & ' a $ty {
2073
2074
& self . 0
2074
2075
}
2075
2076
}
2076
2077
2077
- impl <' tcx> PartialEq for Interned <' tcx, $ty> {
2078
+ impl <' tcx> PartialEq for InternedInSet <' tcx, $ty> {
2078
2079
fn eq( & self , other: & Self ) -> bool {
2079
2080
// The `Borrow` trait requires that `x.borrow() == y.borrow()`
2080
2081
// equals `x == y`.
2081
2082
self . 0 == other. 0
2082
2083
}
2083
2084
}
2084
2085
2085
- impl <' tcx> Eq for Interned <' tcx, $ty> { }
2086
+ impl <' tcx> Eq for InternedInSet <' tcx, $ty> { }
2086
2087
2087
- impl <' tcx> Hash for Interned <' tcx, $ty> {
2088
+ impl <' tcx> Hash for InternedInSet <' tcx, $ty> {
2088
2089
fn hash<H : Hasher >( & self , s: & mut H ) {
2089
2090
// The `Borrow` trait requires that `x.borrow().hash(s) ==
2090
2091
// x.hash(s)`.
@@ -2095,7 +2096,7 @@ macro_rules! direct_interners {
2095
2096
impl <' tcx> TyCtxt <' tcx> {
2096
2097
pub fn $method( self , v: $ty) -> & ' tcx $ty {
2097
2098
self . interners. $name. intern( v, |v| {
2098
- Interned ( self . interners. arena. alloc( v) )
2099
+ InternedInSet ( self . interners. arena. alloc( v) )
2099
2100
} ) . 0
2100
2101
}
2101
2102
} ) +
@@ -2117,7 +2118,7 @@ macro_rules! slice_interners {
2117
2118
impl <' tcx> TyCtxt <' tcx> {
2118
2119
$( pub fn $method( self , v: & [ $ty] ) -> & ' tcx List <$ty> {
2119
2120
self . interners. $field. intern_ref( v, || {
2120
- Interned ( List :: from_arena( & * self . arena, v) )
2121
+ InternedInSet ( List :: from_arena( & * self . arena, v) )
2121
2122
} ) . 0
2122
2123
} ) +
2123
2124
}
0 commit comments