13
13
use cstore:: { self , CStore , CrateSource , MetadataBlob } ;
14
14
use locator:: { self , CratePaths } ;
15
15
use native_libs:: relevant_lib;
16
- use schema:: { CrateRoot , Tracked } ;
16
+ use schema:: CrateRoot ;
17
17
18
18
use rustc:: hir:: def_id:: { CrateNum , DefIndex } ;
19
19
use rustc:: hir:: svh:: Svh ;
@@ -261,16 +261,13 @@ impl<'a> CrateLoader<'a> {
261
261
crate_root. def_path_table . decode ( & metadata)
262
262
} ) ;
263
263
264
- let exported_symbols = crate_root. exported_symbols
265
- . map ( |x| x. decode ( & metadata) . collect ( ) ) ;
264
+ let exported_symbols = crate_root. exported_symbols . decode ( & metadata) . collect ( ) ;
266
265
267
266
let trait_impls = crate_root
268
267
. impls
269
- . map ( |impls| {
270
- impls. decode ( & metadata)
271
- . map ( |trait_impls| ( trait_impls. trait_id , trait_impls. impls ) )
272
- . collect ( )
273
- } ) ;
268
+ . decode ( & metadata)
269
+ . map ( |trait_impls| ( trait_impls. trait_id , trait_impls. impls ) )
270
+ . collect ( ) ;
274
271
275
272
let mut cmeta = cstore:: CrateMetadata {
276
273
name,
@@ -295,23 +292,17 @@ impl<'a> CrateLoader<'a> {
295
292
} ,
296
293
// Initialize this with an empty set. The field is populated below
297
294
// after we were able to deserialize its contents.
298
- dllimport_foreign_items : Tracked :: new ( FxHashSet ( ) ) ,
295
+ dllimport_foreign_items : FxHashSet ( ) ,
299
296
} ;
300
297
301
- let dllimports: Tracked < FxHashSet < _ > > = cmeta
298
+ let dllimports: FxHashSet < _ > = cmeta
302
299
. root
303
300
. native_libraries
304
- . map ( |native_libraries| {
305
- let native_libraries: Vec < _ > = native_libraries. decode ( & cmeta)
306
- . collect ( ) ;
307
- native_libraries
308
- . iter ( )
309
- . filter ( |lib| relevant_lib ( self . sess , lib) &&
310
- lib. kind == cstore:: NativeLibraryKind :: NativeUnknown )
311
- . flat_map ( |lib| lib. foreign_items . iter ( ) )
312
- . map ( |id| * id)
313
- . collect ( )
314
- } ) ;
301
+ . decode ( & cmeta)
302
+ . filter ( |lib| relevant_lib ( self . sess , lib) &&
303
+ lib. kind == cstore:: NativeLibraryKind :: NativeUnknown )
304
+ . flat_map ( |lib| lib. foreign_items . into_iter ( ) )
305
+ . collect ( ) ;
315
306
316
307
cmeta. dllimport_foreign_items = dllimports;
317
308
@@ -469,7 +460,6 @@ impl<'a> CrateLoader<'a> {
469
460
// We map 0 and all other holes in the map to our parent crate. The "additional"
470
461
// self-dependencies should be harmless.
471
462
:: std:: iter:: once ( krate) . chain ( crate_root. crate_deps
472
- . get_untracked ( )
473
463
. decode ( metadata)
474
464
. map ( |dep| {
475
465
debug ! ( "resolving dep crate {} hash: `{}`" , dep. name, dep. hash) ;
@@ -692,16 +682,14 @@ impl<'a> CrateLoader<'a> {
692
682
let mut needs_panic_runtime = attr:: contains_name ( & krate. attrs ,
693
683
"needs_panic_runtime" ) ;
694
684
695
- let dep_graph = & self . sess . dep_graph ;
696
-
697
685
self . cstore . iter_crate_data ( |cnum, data| {
698
686
needs_panic_runtime = needs_panic_runtime ||
699
- data. needs_panic_runtime ( dep_graph ) ;
700
- if data. is_panic_runtime ( dep_graph ) {
687
+ data. needs_panic_runtime ( ) ;
688
+ if data. is_panic_runtime ( ) {
701
689
// Inject a dependency from all #![needs_panic_runtime] to this
702
690
// #![panic_runtime] crate.
703
691
self . inject_dependency_if ( cnum, "a panic runtime" ,
704
- & |data| data. needs_panic_runtime ( dep_graph ) ) ;
692
+ & |data| data. needs_panic_runtime ( ) ) ;
705
693
runtime_found = runtime_found || data. dep_kind . get ( ) == DepKind :: Explicit ;
706
694
}
707
695
} ) ;
@@ -737,19 +725,19 @@ impl<'a> CrateLoader<'a> {
737
725
738
726
// Sanity check the loaded crate to ensure it is indeed a panic runtime
739
727
// and the panic strategy is indeed what we thought it was.
740
- if !data. is_panic_runtime ( dep_graph ) {
728
+ if !data. is_panic_runtime ( ) {
741
729
self . sess . err ( & format ! ( "the crate `{}` is not a panic runtime" ,
742
730
name) ) ;
743
731
}
744
- if data. panic_strategy ( dep_graph ) != desired_strategy {
732
+ if data. panic_strategy ( ) != desired_strategy {
745
733
self . sess . err ( & format ! ( "the crate `{}` does not have the panic \
746
734
strategy `{}`",
747
735
name, desired_strategy. desc( ) ) ) ;
748
736
}
749
737
750
738
self . sess . injected_panic_runtime . set ( Some ( cnum) ) ;
751
739
self . inject_dependency_if ( cnum, "a panic runtime" ,
752
- & |data| data. needs_panic_runtime ( dep_graph ) ) ;
740
+ & |data| data. needs_panic_runtime ( ) ) ;
753
741
}
754
742
755
743
fn inject_sanitizer_runtime ( & mut self ) {
@@ -844,7 +832,7 @@ impl<'a> CrateLoader<'a> {
844
832
PathKind :: Crate , dep_kind) ;
845
833
846
834
// Sanity check the loaded crate to ensure it is indeed a sanitizer runtime
847
- if !data. is_sanitizer_runtime ( & self . sess . dep_graph ) {
835
+ if !data. is_sanitizer_runtime ( ) {
848
836
self . sess . err ( & format ! ( "the crate `{}` is not a sanitizer runtime" ,
849
837
name) ) ;
850
838
}
@@ -865,7 +853,7 @@ impl<'a> CrateLoader<'a> {
865
853
PathKind :: Crate , dep_kind) ;
866
854
867
855
// Sanity check the loaded crate to ensure it is indeed a profiler runtime
868
- if !data. is_profiler_runtime ( & self . sess . dep_graph ) {
856
+ if !data. is_profiler_runtime ( ) {
869
857
self . sess . err ( & format ! ( "the crate `profiler_builtins` is not \
870
858
a profiler runtime") ) ;
871
859
}
@@ -883,9 +871,8 @@ impl<'a> CrateLoader<'a> {
883
871
// written down in liballoc.
884
872
let mut needs_allocator = attr:: contains_name ( & krate. attrs ,
885
873
"needs_allocator" ) ;
886
- let dep_graph = & self . sess . dep_graph ;
887
874
self . cstore . iter_crate_data ( |_, data| {
888
- needs_allocator = needs_allocator || data. needs_allocator ( dep_graph ) ;
875
+ needs_allocator = needs_allocator || data. needs_allocator ( ) ;
889
876
} ) ;
890
877
if !needs_allocator {
891
878
return
@@ -917,14 +904,13 @@ impl<'a> CrateLoader<'a> {
917
904
// First up we check for global allocators. Look at the crate graph here
918
905
// and see what's a global allocator, including if we ourselves are a
919
906
// global allocator.
920
- let dep_graph = & self . sess . dep_graph ;
921
907
let mut global_allocator = if has_global_allocator {
922
908
Some ( None )
923
909
} else {
924
910
None
925
911
} ;
926
912
self . cstore . iter_crate_data ( |_, data| {
927
- if !data. has_global_allocator ( dep_graph ) {
913
+ if !data. has_global_allocator ( ) {
928
914
return
929
915
}
930
916
match global_allocator {
@@ -983,12 +969,6 @@ impl<'a> CrateLoader<'a> {
983
969
DUMMY_SP ,
984
970
PathKind :: Crate , dep_kind) ;
985
971
self . sess . injected_allocator . set ( Some ( cnum) ) ;
986
- // self.cstore.iter_crate_data(|_, data| {
987
- // if !data.needs_allocator(dep_graph) {
988
- // return
989
- // }
990
- // data.cnum_map.borrow_mut().push(cnum);
991
- // });
992
972
}
993
973
994
974
// We're not actually going to inject an allocator, we're going to
@@ -1001,7 +981,7 @@ impl<'a> CrateLoader<'a> {
1001
981
attr:: contains_name ( & krate. attrs , "default_lib_allocator" ) ;
1002
982
self . cstore . iter_crate_data ( |_, data| {
1003
983
if !found_lib_allocator {
1004
- if data. has_default_lib_allocator ( dep_graph ) {
984
+ if data. has_default_lib_allocator ( ) {
1005
985
found_lib_allocator = true ;
1006
986
}
1007
987
}
0 commit comments