@@ -18,13 +18,12 @@ use std::{fmt, iter, mem};
1818use rustc_abi:: { ExternAbi , FieldIdx , Layout , LayoutData , TargetDataLayout , VariantIdx } ;
1919use rustc_ast as ast;
2020use rustc_data_structures:: defer;
21- use rustc_data_structures:: fingerprint:: Fingerprint ;
2221use rustc_data_structures:: fx:: FxHashMap ;
2322use rustc_data_structures:: intern:: Interned ;
2423use rustc_data_structures:: jobserver:: Proxy ;
2524use rustc_data_structures:: profiling:: SelfProfilerRef ;
2625use rustc_data_structures:: sharded:: { IntoPointer , ShardedHashMap } ;
27- use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
26+ use rustc_data_structures:: stable_hasher:: HashStable ;
2827use rustc_data_structures:: steal:: Steal ;
2928use rustc_data_structures:: sync:: {
3029 self , DynSend , DynSync , FreezeReadGuard , Lock , RwLock , WorkerLocal ,
@@ -47,7 +46,7 @@ use rustc_span::def_id::{CRATE_DEF_ID, DefPathHash, StableCrateId};
4746use rustc_span:: { DUMMY_SP , Ident , Span , Symbol , kw} ;
4847use rustc_type_ir:: TyKind :: * ;
4948pub use rustc_type_ir:: lift:: Lift ;
50- use rustc_type_ir:: { CollectAndApply , TypeFlags , WithCachedTypeInfo , elaborate, search_graph} ;
49+ use rustc_type_ir:: { CollectAndApply , WithCachedTypeInfo , elaborate, search_graph} ;
5150use tracing:: { debug, instrument} ;
5251
5352use crate :: arena:: Arena ;
@@ -207,16 +206,13 @@ impl<'tcx> CtxtInterners<'tcx> {
207206 /// Interns a type. (Use `mk_*` functions instead, where possible.)
208207 #[ allow( rustc:: usage_of_ty_tykind) ]
209208 #[ inline( never) ]
210- fn intern_ty ( & self , kind : TyKind < ' tcx > , sess : & Session , untracked : & Untracked ) -> Ty < ' tcx > {
209+ fn intern_ty ( & self , kind : TyKind < ' tcx > ) -> Ty < ' tcx > {
211210 Ty ( Interned :: new_unchecked (
212211 self . type_
213212 . intern ( kind, |kind| {
214213 let flags = ty:: FlagComputation :: < TyCtxt < ' tcx > > :: for_kind ( & kind) ;
215- let stable_hash = self . stable_hash ( & flags, sess, untracked, & kind) ;
216-
217214 InternedInSet ( self . arena . alloc ( WithCachedTypeInfo {
218215 internee : kind,
219- stable_hash,
220216 flags : flags. flags ,
221217 outer_exclusive_binder : flags. outer_exclusive_binder ,
222218 } ) )
@@ -228,21 +224,13 @@ impl<'tcx> CtxtInterners<'tcx> {
228224 /// Interns a const. (Use `mk_*` functions instead, where possible.)
229225 #[ allow( rustc:: usage_of_ty_tykind) ]
230226 #[ inline( never) ]
231- fn intern_const (
232- & self ,
233- kind : ty:: ConstKind < ' tcx > ,
234- sess : & Session ,
235- untracked : & Untracked ,
236- ) -> Const < ' tcx > {
227+ fn intern_const ( & self , kind : ty:: ConstKind < ' tcx > ) -> Const < ' tcx > {
237228 Const ( Interned :: new_unchecked (
238229 self . const_
239230 . intern ( kind, |kind : ty:: ConstKind < ' _ > | {
240231 let flags = ty:: FlagComputation :: < TyCtxt < ' tcx > > :: for_const_kind ( & kind) ;
241- let stable_hash = self . stable_hash ( & flags, sess, untracked, & kind) ;
242-
243232 InternedInSet ( self . arena . alloc ( WithCachedTypeInfo {
244233 internee : kind,
245- stable_hash,
246234 flags : flags. flags ,
247235 outer_exclusive_binder : flags. outer_exclusive_binder ,
248236 } ) )
@@ -251,43 +239,15 @@ impl<'tcx> CtxtInterners<'tcx> {
251239 ) )
252240 }
253241
254- fn stable_hash < ' a , T : HashStable < StableHashingContext < ' a > > > (
255- & self ,
256- flags : & ty:: FlagComputation < TyCtxt < ' tcx > > ,
257- sess : & ' a Session ,
258- untracked : & ' a Untracked ,
259- val : & T ,
260- ) -> Fingerprint {
261- // It's impossible to hash inference variables (and will ICE), so we don't need to try to cache them.
262- // Without incremental, we rarely stable-hash types, so let's not do it proactively.
263- if flags. flags . intersects ( TypeFlags :: HAS_INFER ) || sess. opts . incremental . is_none ( ) {
264- Fingerprint :: ZERO
265- } else {
266- let mut hasher = StableHasher :: new ( ) ;
267- let mut hcx = StableHashingContext :: new ( sess, untracked) ;
268- val. hash_stable ( & mut hcx, & mut hasher) ;
269- hasher. finish ( )
270- }
271- }
272-
273242 /// Interns a predicate. (Use `mk_predicate` instead, where possible.)
274243 #[ inline( never) ]
275- fn intern_predicate (
276- & self ,
277- kind : Binder < ' tcx , PredicateKind < ' tcx > > ,
278- sess : & Session ,
279- untracked : & Untracked ,
280- ) -> Predicate < ' tcx > {
244+ fn intern_predicate ( & self , kind : Binder < ' tcx , PredicateKind < ' tcx > > ) -> Predicate < ' tcx > {
281245 Predicate ( Interned :: new_unchecked (
282246 self . predicate
283247 . intern ( kind, |kind| {
284248 let flags = ty:: FlagComputation :: < TyCtxt < ' tcx > > :: for_predicate ( kind) ;
285-
286- let stable_hash = self . stable_hash ( & flags, sess, untracked, & kind) ;
287-
288249 InternedInSet ( self . arena . alloc ( WithCachedTypeInfo {
289250 internee : kind,
290- stable_hash,
291251 flags : flags. flags ,
292252 outer_exclusive_binder : flags. outer_exclusive_binder ,
293253 } ) )
@@ -423,12 +383,8 @@ pub struct CommonConsts<'tcx> {
423383}
424384
425385impl < ' tcx > CommonTypes < ' tcx > {
426- fn new (
427- interners : & CtxtInterners < ' tcx > ,
428- sess : & Session ,
429- untracked : & Untracked ,
430- ) -> CommonTypes < ' tcx > {
431- let mk = |ty| interners. intern_ty ( ty, sess, untracked) ;
386+ fn new ( interners : & CtxtInterners < ' tcx > ) -> CommonTypes < ' tcx > {
387+ let mk = |ty| interners. intern_ty ( ty) ;
432388
433389 let ty_vars =
434390 ( 0 ..NUM_PREINTERNED_TY_VARS ) . map ( |n| mk ( Infer ( ty:: TyVar ( TyVid :: from ( n) ) ) ) ) . collect ( ) ;
@@ -544,18 +500,8 @@ impl<'tcx> CommonLifetimes<'tcx> {
544500}
545501
546502impl < ' tcx > CommonConsts < ' tcx > {
547- fn new (
548- interners : & CtxtInterners < ' tcx > ,
549- types : & CommonTypes < ' tcx > ,
550- sess : & Session ,
551- untracked : & Untracked ,
552- ) -> CommonConsts < ' tcx > {
553- let mk_const = |c| {
554- interners. intern_const (
555- c, sess, // This is only used to create a stable hashing context.
556- untracked,
557- )
558- } ;
503+ fn new ( interners : & CtxtInterners < ' tcx > , types : & CommonTypes < ' tcx > ) -> CommonConsts < ' tcx > {
504+ let mk_const = |c| interners. intern_const ( c) ;
559505
560506 let mk_valtree = |v| {
561507 ty:: ValTree ( Interned :: new_unchecked (
@@ -1030,9 +976,9 @@ impl<'tcx> TyCtxt<'tcx> {
1030976 s. dcx ( ) . emit_fatal ( err) ;
1031977 } ) ;
1032978 let interners = CtxtInterners :: new ( arena) ;
1033- let common_types = CommonTypes :: new ( & interners, s , & untracked ) ;
979+ let common_types = CommonTypes :: new ( & interners) ;
1034980 let common_lifetimes = CommonLifetimes :: new ( & interners) ;
1035- let common_consts = CommonConsts :: new ( & interners, & common_types, s , & untracked ) ;
981+ let common_consts = CommonConsts :: new ( & interners, & common_types) ;
1036982
1037983 let gcx = gcx_cell. get_or_init ( || GlobalCtxt {
1038984 sess : s,
@@ -2148,12 +2094,7 @@ impl<'tcx> TyCtxt<'tcx> {
21482094
21492095 #[ inline]
21502096 pub fn mk_predicate ( self , binder : Binder < ' tcx , PredicateKind < ' tcx > > ) -> Predicate < ' tcx > {
2151- self . interners . intern_predicate (
2152- binder,
2153- self . sess ,
2154- // This is only used to create a stable hashing context.
2155- & self . untracked ,
2156- )
2097+ self . interners . intern_predicate ( binder)
21572098 }
21582099
21592100 #[ inline]
@@ -2274,24 +2215,14 @@ impl<'tcx> TyCtxt<'tcx> {
22742215
22752216 #[ inline]
22762217 pub fn mk_ct_from_kind ( self , kind : ty:: ConstKind < ' tcx > ) -> Const < ' tcx > {
2277- self . interners . intern_const (
2278- kind,
2279- self . sess ,
2280- // This is only used to create a stable hashing context.
2281- & self . untracked ,
2282- )
2218+ self . interners . intern_const ( kind)
22832219 }
22842220
22852221 // Avoid this in favour of more specific `Ty::new_*` methods, where possible.
22862222 #[ allow( rustc:: usage_of_ty_tykind) ]
22872223 #[ inline]
22882224 pub fn mk_ty_from_kind ( self , st : TyKind < ' tcx > ) -> Ty < ' tcx > {
2289- self . interners . intern_ty (
2290- st,
2291- self . sess ,
2292- // This is only used to create a stable hashing context.
2293- & self . untracked ,
2294- )
2225+ self . interners . intern_ty ( st)
22952226 }
22962227
22972228 pub fn mk_param_from_def ( self , param : & ty:: GenericParamDef ) -> GenericArg < ' tcx > {
0 commit comments