@@ -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 (
@@ -1070,9 +1014,9 @@ impl<'tcx> TyCtxt<'tcx> {
10701014 s. dcx ( ) . emit_fatal ( err) ;
10711015 } ) ;
10721016 let interners = CtxtInterners :: new ( arena) ;
1073- let common_types = CommonTypes :: new ( & interners, s , & untracked ) ;
1017+ let common_types = CommonTypes :: new ( & interners) ;
10741018 let common_lifetimes = CommonLifetimes :: new ( & interners) ;
1075- let common_consts = CommonConsts :: new ( & interners, & common_types, s , & untracked ) ;
1019+ let common_consts = CommonConsts :: new ( & interners, & common_types) ;
10761020
10771021 let gcx = gcx_cell. get_or_init ( || GlobalCtxt {
10781022 sess : s,
@@ -2202,12 +2146,7 @@ impl<'tcx> TyCtxt<'tcx> {
22022146
22032147 #[ inline]
22042148 pub fn mk_predicate ( self , binder : Binder < ' tcx , PredicateKind < ' tcx > > ) -> Predicate < ' tcx > {
2205- self . interners . intern_predicate (
2206- binder,
2207- self . sess ,
2208- // This is only used to create a stable hashing context.
2209- & self . untracked ,
2210- )
2149+ self . interners . intern_predicate ( binder)
22112150 }
22122151
22132152 #[ inline]
@@ -2328,24 +2267,14 @@ impl<'tcx> TyCtxt<'tcx> {
23282267
23292268 #[ inline]
23302269 pub fn mk_ct_from_kind ( self , kind : ty:: ConstKind < ' tcx > ) -> Const < ' tcx > {
2331- self . interners . intern_const (
2332- kind,
2333- self . sess ,
2334- // This is only used to create a stable hashing context.
2335- & self . untracked ,
2336- )
2270+ self . interners . intern_const ( kind)
23372271 }
23382272
23392273 // Avoid this in favour of more specific `Ty::new_*` methods, where possible.
23402274 #[ allow( rustc:: usage_of_ty_tykind) ]
23412275 #[ inline]
23422276 pub fn mk_ty_from_kind ( self , st : TyKind < ' tcx > ) -> Ty < ' tcx > {
2343- self . interners . intern_ty (
2344- st,
2345- self . sess ,
2346- // This is only used to create a stable hashing context.
2347- & self . untracked ,
2348- )
2277+ self . interners . intern_ty ( st)
23492278 }
23502279
23512280 pub fn mk_param_from_def ( self , param : & ty:: GenericParamDef ) -> GenericArg < ' tcx > {
0 commit comments