@@ -113,6 +113,12 @@ pub struct CtxtInterners<'tcx> {
113
113
bound_variable_kinds : InternedSet < ' tcx , List < ty:: BoundVariableKind > > ,
114
114
layout : InternedSet < ' tcx , Layout > ,
115
115
adt_def : InternedSet < ' tcx , AdtDef > ,
116
+
117
+ /// `#[stable]` and `#[unstable]` attributes
118
+ stability : InternedSet < ' tcx , attr:: Stability > ,
119
+
120
+ /// `#[rustc_const_stable]` and `#[rustc_const_unstable]` attributes
121
+ const_stability : InternedSet < ' tcx , attr:: ConstStability > ,
116
122
}
117
123
118
124
impl < ' tcx > CtxtInterners < ' tcx > {
@@ -134,6 +140,8 @@ impl<'tcx> CtxtInterners<'tcx> {
134
140
bound_variable_kinds : Default :: default ( ) ,
135
141
layout : Default :: default ( ) ,
136
142
adt_def : Default :: default ( ) ,
143
+ stability : Default :: default ( ) ,
144
+ const_stability : Default :: default ( ) ,
137
145
}
138
146
}
139
147
@@ -1035,12 +1043,6 @@ pub struct GlobalCtxt<'tcx> {
1035
1043
/// Data layout specification for the current target.
1036
1044
pub data_layout : TargetDataLayout ,
1037
1045
1038
- /// `#[stable]` and `#[unstable]` attributes
1039
- stability_interner : ShardedHashMap < & ' tcx attr:: Stability , ( ) > ,
1040
-
1041
- /// `#[rustc_const_stable]` and `#[rustc_const_unstable]` attributes
1042
- const_stability_interner : ShardedHashMap < & ' tcx attr:: ConstStability , ( ) > ,
1043
-
1044
1046
/// Stores memory for globals (statics/consts).
1045
1047
pub ( crate ) alloc_map : Lock < interpret:: AllocMap < ' tcx > > ,
1046
1048
@@ -1092,16 +1094,6 @@ impl<'tcx> TyCtxt<'tcx> {
1092
1094
self . create_memory_alloc ( alloc)
1093
1095
}
1094
1096
1095
- // FIXME(eddyb) move to `direct_interners!`.
1096
- pub fn intern_stability ( self , stab : attr:: Stability ) -> & ' tcx attr:: Stability {
1097
- self . stability_interner . intern ( stab, |stab| self . arena . alloc ( stab) )
1098
- }
1099
-
1100
- // FIXME(eddyb) move to `direct_interners!`.
1101
- pub fn intern_const_stability ( self , stab : attr:: ConstStability ) -> & ' tcx attr:: ConstStability {
1102
- self . const_stability_interner . intern ( stab, |stab| self . arena . alloc ( stab) )
1103
- }
1104
-
1105
1097
/// Returns a range of the start/end indices specified with the
1106
1098
/// `rustc_layout_scalar_valid_range` attribute.
1107
1099
// FIXME(eddyb) this is an awkward spot for this method, maybe move it?
@@ -1185,8 +1177,6 @@ impl<'tcx> TyCtxt<'tcx> {
1185
1177
evaluation_cache : Default :: default ( ) ,
1186
1178
crate_name : Symbol :: intern ( crate_name) ,
1187
1179
data_layout,
1188
- stability_interner : Default :: default ( ) ,
1189
- const_stability_interner : Default :: default ( ) ,
1190
1180
alloc_map : Lock :: new ( interpret:: AllocMap :: new ( ) ) ,
1191
1181
output_filenames : Arc :: new ( output_filenames) ,
1192
1182
}
@@ -1935,11 +1925,11 @@ impl<'tcx> TyCtxt<'tcx> {
1935
1925
1936
1926
writeln ! ( fmt, "InternalSubsts interner: #{}" , self . 0 . interners. substs. len( ) ) ?;
1937
1927
writeln ! ( fmt, "Region interner: #{}" , self . 0 . interners. region. len( ) ) ?;
1938
- writeln ! ( fmt, "Stability interner: #{}" , self . 0 . stability_interner . len( ) ) ?;
1928
+ writeln ! ( fmt, "Stability interner: #{}" , self . 0 . interners . stability . len( ) ) ?;
1939
1929
writeln ! (
1940
1930
fmt,
1941
1931
"Const Stability interner: #{}" ,
1942
- self . 0 . const_stability_interner . len( )
1932
+ self . 0 . interners . const_stability . len( )
1943
1933
) ?;
1944
1934
writeln ! (
1945
1935
fmt,
@@ -2072,6 +2062,8 @@ direct_interners! {
2072
2062
const_allocation: intern_const_alloc( Allocation ) ,
2073
2063
layout: intern_layout( Layout ) ,
2074
2064
adt_def: intern_adt_def( AdtDef ) ,
2065
+ stability: intern_stability( attr:: Stability ) ,
2066
+ const_stability: intern_const_stability( attr:: ConstStability ) ,
2075
2067
}
2076
2068
2077
2069
macro_rules! slice_interners {
0 commit comments