@@ -6,7 +6,7 @@ use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob
66
77use rustc_ast:: expand:: allocator:: AllocatorKind ;
88use rustc_ast:: { self as ast, * } ;
9- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
9+ use rustc_data_structures:: fx:: FxHashSet ;
1010use rustc_data_structures:: svh:: Svh ;
1111use rustc_data_structures:: sync:: MappedReadGuard ;
1212use rustc_expand:: base:: SyntaxExtension ;
@@ -46,10 +46,6 @@ pub struct CStore {
4646 /// This crate has a `#[alloc_error_handler]` item.
4747 has_alloc_error_handler : bool ,
4848
49- /// This map is used to verify we get no hash conflicts between
50- /// `StableCrateId` values.
51- pub ( crate ) stable_crate_ids : FxHashMap < StableCrateId , CrateNum > ,
52-
5349 /// Unused externs of the crate
5450 unused_externs : Vec < Symbol > ,
5551}
@@ -240,9 +236,7 @@ impl CStore {
240236 }
241237 }
242238
243- pub fn new ( sess : & Session ) -> CStore {
244- let mut stable_crate_ids = FxHashMap :: default ( ) ;
245- stable_crate_ids. insert ( sess. local_stable_crate_id ( ) , LOCAL_CRATE ) ;
239+ pub fn new ( ) -> CStore {
246240 CStore {
247241 // We add an empty entry for LOCAL_CRATE (which maps to zero) in
248242 // order to make array indices in `metas` match with the
@@ -254,7 +248,6 @@ impl CStore {
254248 alloc_error_handler_kind : None ,
255249 has_global_allocator : false ,
256250 has_alloc_error_handler : false ,
257- stable_crate_ids,
258251 unused_externs : Vec :: new ( ) ,
259252 }
260253 }
@@ -361,20 +354,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
361354 Ok ( ( ) )
362355 }
363356
364- fn verify_no_stable_crate_id_hash_conflicts (
365- & mut self ,
366- root : & CrateRoot ,
367- cnum : CrateNum ,
368- ) -> Result < ( ) , CrateError > {
369- if let Some ( existing) = self . cstore . stable_crate_ids . insert ( root. stable_crate_id ( ) , cnum) {
370- let crate_name0 = root. name ( ) ;
371- let crate_name1 = self . cstore . get_crate_data ( existing) . name ( ) ;
372- return Err ( CrateError :: StableCrateIdCollision ( crate_name0, crate_name1) ) ;
373- }
374-
375- Ok ( ( ) )
376- }
377-
378357 fn register_crate (
379358 & mut self ,
380359 host_lib : Option < Library > ,
@@ -435,7 +414,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
435414 // and dependency resolution and the verification code would produce
436415 // ICEs in that case (see #83045).
437416 self . verify_no_symbol_conflicts ( & crate_root) ?;
438- self . verify_no_stable_crate_id_hash_conflicts ( & crate_root, cnum) ? ;
417+ self . tcx . feed_stable_crate_id ( crate_root. stable_crate_id ( ) , cnum) ;
439418
440419 let crate_metadata = CrateMetadata :: new (
441420 self . sess ,
0 commit comments