@@ -6,7 +6,7 @@ use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob
6
6
7
7
use rustc_ast:: expand:: allocator:: AllocatorKind ;
8
8
use rustc_ast:: { self as ast, * } ;
9
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
9
+ use rustc_data_structures:: fx:: FxHashSet ;
10
10
use rustc_data_structures:: svh:: Svh ;
11
11
use rustc_data_structures:: sync:: MappedReadGuard ;
12
12
use rustc_expand:: base:: SyntaxExtension ;
@@ -46,10 +46,6 @@ pub struct CStore {
46
46
/// This crate has a `#[alloc_error_handler]` item.
47
47
has_alloc_error_handler : bool ,
48
48
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
-
53
49
/// Unused externs of the crate
54
50
unused_externs : Vec < Symbol > ,
55
51
}
@@ -240,9 +236,7 @@ impl CStore {
240
236
}
241
237
}
242
238
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 {
246
240
CStore {
247
241
// We add an empty entry for LOCAL_CRATE (which maps to zero) in
248
242
// order to make array indices in `metas` match with the
@@ -254,7 +248,6 @@ impl CStore {
254
248
alloc_error_handler_kind : None ,
255
249
has_global_allocator : false ,
256
250
has_alloc_error_handler : false ,
257
- stable_crate_ids,
258
251
unused_externs : Vec :: new ( ) ,
259
252
}
260
253
}
@@ -361,20 +354,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
361
354
Ok ( ( ) )
362
355
}
363
356
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
-
378
357
fn register_crate (
379
358
& mut self ,
380
359
host_lib : Option < Library > ,
@@ -435,7 +414,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
435
414
// and dependency resolution and the verification code would produce
436
415
// ICEs in that case (see #83045).
437
416
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) ;
439
418
440
419
let crate_metadata = CrateMetadata :: new (
441
420
self . sess ,
0 commit comments