@@ -16,9 +16,10 @@ use crate::{CachedModuleCodegen, CompiledModule, CrateInfo, MemFlags, ModuleCode
16
16
17
17
use rustc_ast:: expand:: allocator:: { global_fn_name, AllocatorKind , ALLOCATOR_METHODS } ;
18
18
use rustc_attr as attr;
19
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
19
+ use rustc_data_structures:: fx:: { FxHashMap , FxIndexSet } ;
20
20
use rustc_data_structures:: profiling:: { get_resident_set_size, print_time_passes_entry} ;
21
21
use rustc_data_structures:: sync:: par_map;
22
+ use rustc_data_structures:: unord:: UnordMap ;
22
23
use rustc_hir as hir;
23
24
use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
24
25
use rustc_hir:: lang_items:: LangItem ;
@@ -851,6 +852,8 @@ impl CrateInfo {
851
852
// `compiler_builtins` are always placed last to ensure that they're linked correctly.
852
853
used_crates. extend ( compiler_builtins) ;
853
854
855
+ let crates = tcx. crates ( ( ) ) ;
856
+ let n_crates = crates. len ( ) ;
854
857
let mut info = CrateInfo {
855
858
target_cpu,
856
859
crate_types,
@@ -862,19 +865,15 @@ impl CrateInfo {
862
865
is_no_builtins : Default :: default ( ) ,
863
866
native_libraries : Default :: default ( ) ,
864
867
used_libraries : tcx. native_libraries ( LOCAL_CRATE ) . iter ( ) . map ( Into :: into) . collect ( ) ,
865
- crate_name : Default :: default ( ) ,
868
+ crate_name : UnordMap :: with_capacity ( n_crates ) ,
866
869
used_crates,
867
- used_crate_source : Default :: default ( ) ,
870
+ used_crate_source : UnordMap :: with_capacity ( n_crates ) ,
868
871
dependency_formats : tcx. dependency_formats ( ( ) ) . clone ( ) ,
869
872
windows_subsystem,
870
873
natvis_debugger_visualizers : Default :: default ( ) ,
871
874
} ;
872
- let crates = tcx. crates ( ( ) ) ;
873
875
874
- let n_crates = crates. len ( ) ;
875
876
info. native_libraries . reserve ( n_crates) ;
876
- info. crate_name . reserve ( n_crates) ;
877
- info. used_crate_source . reserve ( n_crates) ;
878
877
879
878
for & cnum in crates. iter ( ) {
880
879
info. native_libraries
@@ -901,7 +900,7 @@ impl CrateInfo {
901
900
// by the compiler, but that's ok because all this stuff is unstable anyway.
902
901
let target = & tcx. sess . target ;
903
902
if !are_upstream_rust_objects_already_included ( tcx. sess ) {
904
- let missing_weak_lang_items: FxHashSet < Symbol > = info
903
+ let missing_weak_lang_items: FxIndexSet < Symbol > = info
905
904
. used_crates
906
905
. iter ( )
907
906
. flat_map ( |& cnum| tcx. missing_lang_items ( cnum) )
@@ -915,7 +914,6 @@ impl CrateInfo {
915
914
916
915
// This loop only adds new items to values of the hash map, so the order in which we
917
916
// iterate over the values is not important.
918
- #[ allow( rustc:: potential_query_instability) ]
919
917
info. linked_symbols
920
918
. iter_mut ( )
921
919
. filter ( |( crate_type, _) | {
0 commit comments