@@ -58,9 +58,9 @@ pub struct CrateLoader<'a> {
58
58
fn dump_crates ( cstore : & CStore ) {
59
59
info ! ( "resolved crates:" ) ;
60
60
cstore. iter_crate_data ( |_, data| {
61
- info ! ( " name: {}" , data. name( ) ) ;
61
+ info ! ( " name: {}" , data. root . name) ;
62
62
info ! ( " cnum: {}" , data. cnum) ;
63
- info ! ( " hash: {}" , data. hash( ) ) ;
63
+ info ! ( " hash: {}" , data. root . hash) ;
64
64
info ! ( " reqd: {:?}" , * data. dep_kind. lock( ) ) ;
65
65
let CrateSource { dylib, rlib, rmeta } = data. source . clone ( ) ;
66
66
dylib. map ( |dl| info ! ( " dylib: {}" , dl. 0 . display( ) ) ) ;
@@ -113,7 +113,7 @@ impl<'a> CrateLoader<'a> {
113
113
if data. name != name { return }
114
114
115
115
match hash {
116
- Some ( hash) if * hash == data. hash ( ) => { ret = Some ( cnum) ; return }
116
+ Some ( hash) if * hash == data. root . hash => { ret = Some ( cnum) ; return }
117
117
Some ( ..) => return ,
118
118
None => { }
119
119
}
@@ -172,9 +172,9 @@ impl<'a> CrateLoader<'a> {
172
172
173
173
// Check for conflicts with any crate loaded so far
174
174
self . cstore . iter_crate_data ( |_, other| {
175
- if other. name ( ) == root. name && // same crate-name
176
- other. disambiguator ( ) == root. disambiguator && // same crate-disambiguator
177
- other. hash ( ) != root. hash { // but different SVH
175
+ if other. root . name == root. name && // same crate-name
176
+ other. root . disambiguator == root. disambiguator && // same crate-disambiguator
177
+ other. root . hash != root. hash { // but different SVH
178
178
span_fatal ! ( self . sess, span, E0523 ,
179
179
"found two different crates with name `{}` that are \
180
180
not distinguished by differing `-C metadata`. This \
@@ -214,7 +214,6 @@ impl<'a> CrateLoader<'a> {
214
214
let root = if root. is_some ( ) { root } else { & crate_paths } ;
215
215
216
216
let Library { dylib, rlib, rmeta, metadata } = lib;
217
-
218
217
let cnum_map = self . resolve_crate_deps ( root, & crate_root, & metadata, cnum, span, dep_kind) ;
219
218
220
219
let dependencies: Vec < CrateNum > = cnum_map. iter ( ) . cloned ( ) . collect ( ) ;
@@ -243,13 +242,12 @@ impl<'a> CrateLoader<'a> {
243
242
cnum,
244
243
dependencies : Lock :: new ( dependencies) ,
245
244
codemap_import_info : RwLock :: new ( vec ! [ ] ) ,
246
- attribute_cache : Lock :: new ( [ Vec :: new ( ) , Vec :: new ( ) ] ) ,
247
245
dep_kind : Lock :: new ( dep_kind) ,
248
246
source : cstore:: CrateSource {
249
247
dylib,
250
248
rlib,
251
249
rmeta,
252
- } ,
250
+ }
253
251
} ;
254
252
255
253
let cmeta = Lrc :: new ( cmeta) ;
@@ -345,7 +343,7 @@ impl<'a> CrateLoader<'a> {
345
343
if locate_ctxt. triple == & self . sess . opts . target_triple {
346
344
let mut result = LoadResult :: Loaded ( library) ;
347
345
self . cstore . iter_crate_data ( |cnum, data| {
348
- if data. name ( ) == root. name && root. hash == data. hash ( ) {
346
+ if data. root . name == root. name && root. hash == data. root . hash {
349
347
assert ! ( locate_ctxt. hash. is_none( ) ) ;
350
348
info ! ( "load success, going to previous cnum: {}" , cnum) ;
351
349
result = LoadResult :: Previous ( cnum) ;
@@ -642,15 +640,14 @@ impl<'a> CrateLoader<'a> {
642
640
let mut needs_panic_runtime = attr:: contains_name ( & krate. attrs ,
643
641
"needs_panic_runtime" ) ;
644
642
645
- let sess = self . sess ;
646
643
self . cstore . iter_crate_data ( |cnum, data| {
647
644
needs_panic_runtime = needs_panic_runtime ||
648
- data. needs_panic_runtime ( sess ) ;
649
- if data. is_panic_runtime ( sess ) {
645
+ data. root . needs_panic_runtime ;
646
+ if data. root . panic_runtime {
650
647
// Inject a dependency from all #![needs_panic_runtime] to this
651
648
// #![panic_runtime] crate.
652
649
self . inject_dependency_if ( cnum, "a panic runtime" ,
653
- & |data| data. needs_panic_runtime ( sess ) ) ;
650
+ & |data| data. root . needs_panic_runtime ) ;
654
651
runtime_found = runtime_found || * data. dep_kind . lock ( ) == DepKind :: Explicit ;
655
652
}
656
653
} ) ;
@@ -687,19 +684,19 @@ impl<'a> CrateLoader<'a> {
687
684
688
685
// Sanity check the loaded crate to ensure it is indeed a panic runtime
689
686
// and the panic strategy is indeed what we thought it was.
690
- if !data. is_panic_runtime ( self . sess ) {
687
+ if !data. root . panic_runtime {
691
688
self . sess . err ( & format ! ( "the crate `{}` is not a panic runtime" ,
692
689
name) ) ;
693
690
}
694
- if data. panic_strategy ( ) != desired_strategy {
691
+ if data. root . panic_strategy != desired_strategy {
695
692
self . sess . err ( & format ! ( "the crate `{}` does not have the panic \
696
693
strategy `{}`",
697
694
name, desired_strategy. desc( ) ) ) ;
698
695
}
699
696
700
697
self . sess . injected_panic_runtime . set ( Some ( cnum) ) ;
701
698
self . inject_dependency_if ( cnum, "a panic runtime" ,
702
- & |data| data. needs_panic_runtime ( self . sess ) ) ;
699
+ & |data| data. root . needs_panic_runtime ) ;
703
700
}
704
701
705
702
fn inject_sanitizer_runtime ( & mut self ) {
@@ -794,7 +791,7 @@ impl<'a> CrateLoader<'a> {
794
791
PathKind :: Crate , dep_kind) ;
795
792
796
793
// Sanity check the loaded crate to ensure it is indeed a sanitizer runtime
797
- if !data. is_sanitizer_runtime ( self . sess ) {
794
+ if !data. root . sanitizer_runtime {
798
795
self . sess . err ( & format ! ( "the crate `{}` is not a sanitizer runtime" ,
799
796
name) ) ;
800
797
}
@@ -817,7 +814,7 @@ impl<'a> CrateLoader<'a> {
817
814
PathKind :: Crate , dep_kind) ;
818
815
819
816
// Sanity check the loaded crate to ensure it is indeed a profiler runtime
820
- if !data. is_profiler_runtime ( self . sess ) {
817
+ if !data. root . profiler_runtime {
821
818
self . sess . err ( & format ! ( "the crate `profiler_builtins` is not \
822
819
a profiler runtime") ) ;
823
820
}
@@ -834,7 +831,7 @@ impl<'a> CrateLoader<'a> {
834
831
let mut needs_allocator = attr:: contains_name ( & krate. attrs ,
835
832
"needs_allocator" ) ;
836
833
self . cstore . iter_crate_data ( |_, data| {
837
- needs_allocator = needs_allocator || data. needs_allocator ( self . sess ) ;
834
+ needs_allocator = needs_allocator || data. root . needs_allocator ;
838
835
} ) ;
839
836
if !needs_allocator {
840
837
self . sess . injected_allocator . set ( None ) ;
@@ -876,7 +873,7 @@ impl<'a> CrateLoader<'a> {
876
873
None
877
874
} ;
878
875
self . cstore . iter_crate_data ( |_, data| {
879
- if !data. has_global_allocator ( ) {
876
+ if !data. root . has_global_allocator {
880
877
return
881
878
}
882
879
match global_allocator {
@@ -885,14 +882,14 @@ impl<'a> CrateLoader<'a> {
885
882
conflicts with this global \
886
883
allocator in: {}",
887
884
other_crate,
888
- data. name( ) ) ) ;
885
+ data. root . name) ) ;
889
886
}
890
887
Some ( None ) => {
891
888
self . sess . err ( & format ! ( "the #[global_allocator] in this \
892
889
crate conflicts with global \
893
- allocator in: {}", data. name( ) ) ) ;
890
+ allocator in: {}", data. root . name) ) ;
894
891
}
895
- None => global_allocator = Some ( Some ( data. name ( ) ) ) ,
892
+ None => global_allocator = Some ( Some ( data. root . name ) ) ,
896
893
}
897
894
} ) ;
898
895
if global_allocator. is_some ( ) {
@@ -954,7 +951,7 @@ impl<'a> CrateLoader<'a> {
954
951
// error.
955
952
let mut allocator = None ;
956
953
self . cstore . iter_crate_data ( |_, data| {
957
- if allocator. is_none ( ) && data. has_default_lib_allocator ( ) {
954
+ if allocator. is_none ( ) && data. root . has_default_lib_allocator {
958
955
allocator = Some ( data. clone ( ) ) ;
959
956
}
960
957
} ) ;
@@ -1030,9 +1027,9 @@ impl<'a> CrateLoader<'a> {
1030
1027
self . sess . err ( & format ! ( "the crate `{}` cannot depend \
1031
1028
on a crate that needs {}, but \
1032
1029
it depends on `{}`",
1033
- self . cstore. get_crate_data( krate) . name( ) ,
1030
+ self . cstore. get_crate_data( krate) . root . name,
1034
1031
what,
1035
- data. name( ) ) ) ;
1032
+ data. root . name) ) ;
1036
1033
}
1037
1034
}
1038
1035
0 commit comments