@@ -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,9 +46,7 @@ use rustc_span::def_id::{CRATE_DEF_ID, DefPathHash, StableCrateId};
4746use rustc_span:: { DUMMY_SP , Ident , Span , Symbol , kw, sym} ;
4847use rustc_type_ir:: TyKind :: * ;
4948pub use rustc_type_ir:: lift:: Lift ;
50- use rustc_type_ir:: {
51- CollectAndApply , FnSigKind , TypeFlags , WithCachedTypeInfo , elaborate, search_graph,
52- } ;
49+ use rustc_type_ir:: { CollectAndApply , FnSigKind , WithCachedTypeInfo , elaborate, search_graph} ;
5350use tracing:: { debug, instrument} ;
5451
5552use crate :: arena:: Arena ;
@@ -247,16 +244,13 @@ impl<'tcx> CtxtInterners<'tcx> {
247244 /// Interns a type. (Use `mk_*` functions instead, where possible.)
248245 #[ allow( rustc:: usage_of_ty_tykind) ]
249246 #[ inline( never) ]
250- fn intern_ty ( & self , kind : TyKind < ' tcx > , sess : & Session , untracked : & Untracked ) -> Ty < ' tcx > {
247+ fn intern_ty ( & self , kind : TyKind < ' tcx > ) -> Ty < ' tcx > {
251248 Ty ( Interned :: new_unchecked (
252249 self . type_
253250 . intern ( kind, |kind| {
254251 let flags = ty:: FlagComputation :: < TyCtxt < ' tcx > > :: for_kind ( & kind) ;
255- let stable_hash = self . stable_hash ( & flags, sess, untracked, & kind) ;
256-
257252 InternedInSet ( self . arena . alloc ( WithCachedTypeInfo {
258253 internee : kind,
259- stable_hash,
260254 flags : flags. flags ,
261255 outer_exclusive_binder : flags. outer_exclusive_binder ,
262256 } ) )
@@ -268,21 +262,13 @@ impl<'tcx> CtxtInterners<'tcx> {
268262 /// Interns a const. (Use `mk_*` functions instead, where possible.)
269263 #[ allow( rustc:: usage_of_ty_tykind) ]
270264 #[ inline( never) ]
271- fn intern_const (
272- & self ,
273- kind : ty:: ConstKind < ' tcx > ,
274- sess : & Session ,
275- untracked : & Untracked ,
276- ) -> Const < ' tcx > {
265+ fn intern_const ( & self , kind : ty:: ConstKind < ' tcx > ) -> Const < ' tcx > {
277266 Const ( Interned :: new_unchecked (
278267 self . const_
279268 . intern ( kind, |kind : ty:: ConstKind < ' _ > | {
280269 let flags = ty:: FlagComputation :: < TyCtxt < ' tcx > > :: for_const_kind ( & kind) ;
281- let stable_hash = self . stable_hash ( & flags, sess, untracked, & kind) ;
282-
283270 InternedInSet ( self . arena . alloc ( WithCachedTypeInfo {
284271 internee : kind,
285- stable_hash,
286272 flags : flags. flags ,
287273 outer_exclusive_binder : flags. outer_exclusive_binder ,
288274 } ) )
@@ -291,43 +277,15 @@ impl<'tcx> CtxtInterners<'tcx> {
291277 ) )
292278 }
293279
294- fn stable_hash < ' a , T : HashStable < StableHashingContext < ' a > > > (
295- & self ,
296- flags : & ty:: FlagComputation < TyCtxt < ' tcx > > ,
297- sess : & ' a Session ,
298- untracked : & ' a Untracked ,
299- val : & T ,
300- ) -> Fingerprint {
301- // It's impossible to hash inference variables (and will ICE), so we don't need to try to cache them.
302- // Without incremental, we rarely stable-hash types, so let's not do it proactively.
303- if flags. flags . intersects ( TypeFlags :: HAS_INFER ) || sess. opts . incremental . is_none ( ) {
304- Fingerprint :: ZERO
305- } else {
306- let mut hasher = StableHasher :: new ( ) ;
307- let mut hcx = StableHashingContext :: new ( sess, untracked) ;
308- val. hash_stable ( & mut hcx, & mut hasher) ;
309- hasher. finish ( )
310- }
311- }
312-
313280 /// Interns a predicate. (Use `mk_predicate` instead, where possible.)
314281 #[ inline( never) ]
315- fn intern_predicate (
316- & self ,
317- kind : Binder < ' tcx , PredicateKind < ' tcx > > ,
318- sess : & Session ,
319- untracked : & Untracked ,
320- ) -> Predicate < ' tcx > {
282+ fn intern_predicate ( & self , kind : Binder < ' tcx , PredicateKind < ' tcx > > ) -> Predicate < ' tcx > {
321283 Predicate ( Interned :: new_unchecked (
322284 self . predicate
323285 . intern ( kind, |kind| {
324286 let flags = ty:: FlagComputation :: < TyCtxt < ' tcx > > :: for_predicate ( kind) ;
325-
326- let stable_hash = self . stable_hash ( & flags, sess, untracked, & kind) ;
327-
328287 InternedInSet ( self . arena . alloc ( WithCachedTypeInfo {
329288 internee : kind,
330- stable_hash,
331289 flags : flags. flags ,
332290 outer_exclusive_binder : flags. outer_exclusive_binder ,
333291 } ) )
@@ -463,12 +421,8 @@ pub struct CommonConsts<'tcx> {
463421}
464422
465423impl < ' tcx > CommonTypes < ' tcx > {
466- fn new (
467- interners : & CtxtInterners < ' tcx > ,
468- sess : & Session ,
469- untracked : & Untracked ,
470- ) -> CommonTypes < ' tcx > {
471- let mk = |ty| interners. intern_ty ( ty, sess, untracked) ;
424+ fn new ( interners : & CtxtInterners < ' tcx > ) -> CommonTypes < ' tcx > {
425+ let mk = |ty| interners. intern_ty ( ty) ;
472426
473427 let ty_vars =
474428 ( 0 ..NUM_PREINTERNED_TY_VARS ) . map ( |n| mk ( Infer ( ty:: TyVar ( TyVid :: from ( n) ) ) ) ) . collect ( ) ;
@@ -584,18 +538,8 @@ impl<'tcx> CommonLifetimes<'tcx> {
584538}
585539
586540impl < ' tcx > CommonConsts < ' tcx > {
587- fn new (
588- interners : & CtxtInterners < ' tcx > ,
589- types : & CommonTypes < ' tcx > ,
590- sess : & Session ,
591- untracked : & Untracked ,
592- ) -> CommonConsts < ' tcx > {
593- let mk_const = |c| {
594- interners. intern_const (
595- c, sess, // This is only used to create a stable hashing context.
596- untracked,
597- )
598- } ;
541+ fn new ( interners : & CtxtInterners < ' tcx > , types : & CommonTypes < ' tcx > ) -> CommonConsts < ' tcx > {
542+ let mk_const = |c| interners. intern_const ( c) ;
599543
600544 let mk_valtree = |v| {
601545 ty:: ValTree ( Interned :: new_unchecked (
@@ -1088,9 +1032,9 @@ impl<'tcx> TyCtxt<'tcx> {
10881032 s. dcx ( ) . emit_fatal ( err) ;
10891033 } ) ;
10901034 let interners = CtxtInterners :: new ( arena) ;
1091- let common_types = CommonTypes :: new ( & interners, s , & untracked ) ;
1035+ let common_types = CommonTypes :: new ( & interners) ;
10921036 let common_lifetimes = CommonLifetimes :: new ( & interners) ;
1093- let common_consts = CommonConsts :: new ( & interners, & common_types, s , & untracked ) ;
1037+ let common_consts = CommonConsts :: new ( & interners, & common_types) ;
10941038
10951039 let gcx = gcx_cell. get_or_init ( || GlobalCtxt {
10961040 sess : s,
@@ -2221,12 +2165,7 @@ impl<'tcx> TyCtxt<'tcx> {
22212165
22222166 #[ inline]
22232167 pub fn mk_predicate ( self , binder : Binder < ' tcx , PredicateKind < ' tcx > > ) -> Predicate < ' tcx > {
2224- self . interners . intern_predicate (
2225- binder,
2226- self . sess ,
2227- // This is only used to create a stable hashing context.
2228- & self . untracked ,
2229- )
2168+ self . interners . intern_predicate ( binder)
22302169 }
22312170
22322171 #[ inline]
@@ -2347,24 +2286,14 @@ impl<'tcx> TyCtxt<'tcx> {
23472286
23482287 #[ inline]
23492288 pub fn mk_ct_from_kind ( self , kind : ty:: ConstKind < ' tcx > ) -> Const < ' tcx > {
2350- self . interners . intern_const (
2351- kind,
2352- self . sess ,
2353- // This is only used to create a stable hashing context.
2354- & self . untracked ,
2355- )
2289+ self . interners . intern_const ( kind)
23562290 }
23572291
23582292 // Avoid this in favour of more specific `Ty::new_*` methods, where possible.
23592293 #[ allow( rustc:: usage_of_ty_tykind) ]
23602294 #[ inline]
23612295 pub fn mk_ty_from_kind ( self , st : TyKind < ' tcx > ) -> Ty < ' tcx > {
2362- self . interners . intern_ty (
2363- st,
2364- self . sess ,
2365- // This is only used to create a stable hashing context.
2366- & self . untracked ,
2367- )
2296+ self . interners . intern_ty ( st)
23682297 }
23692298
23702299 pub fn mk_param_from_def ( self , param : & ty:: GenericParamDef ) -> GenericArg < ' tcx > {
0 commit comments