@@ -58,9 +58,9 @@ pub struct CrateLoader<'a> {
5858fn dump_crates ( cstore : & CStore ) {
5959 info ! ( "resolved crates:" ) ;
6060 cstore. iter_crate_data ( |_, data| {
61- info ! ( " name: {}" , data. name( ) ) ;
61+ info ! ( " name: {}" , data. root . name) ;
6262 info ! ( " cnum: {}" , data. cnum) ;
63- info ! ( " hash: {}" , data. hash( ) ) ;
63+ info ! ( " hash: {}" , data. root . hash) ;
6464 info ! ( " reqd: {:?}" , * data. dep_kind. lock( ) ) ;
6565 let CrateSource { dylib, rlib, rmeta } = data. source . clone ( ) ;
6666 dylib. map ( |dl| info ! ( " dylib: {}" , dl. 0 . display( ) ) ) ;
@@ -113,7 +113,7 @@ impl<'a> CrateLoader<'a> {
113113 if data. name != name { return }
114114
115115 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 }
117117 Some ( ..) => return ,
118118 None => { }
119119 }
@@ -172,9 +172,9 @@ impl<'a> CrateLoader<'a> {
172172
173173 // Check for conflicts with any crate loaded so far
174174 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
178178 span_fatal ! ( self . sess, span, E0523 ,
179179 "found two different crates with name `{}` that are \
180180 not distinguished by differing `-C metadata`. This \
@@ -214,7 +214,6 @@ impl<'a> CrateLoader<'a> {
214214 let root = if root. is_some ( ) { root } else { & crate_paths } ;
215215
216216 let Library { dylib, rlib, rmeta, metadata } = lib;
217-
218217 let cnum_map = self . resolve_crate_deps ( root, & crate_root, & metadata, cnum, span, dep_kind) ;
219218
220219 let dependencies: Vec < CrateNum > = cnum_map. iter ( ) . cloned ( ) . collect ( ) ;
@@ -243,13 +242,12 @@ impl<'a> CrateLoader<'a> {
243242 cnum,
244243 dependencies : Lock :: new ( dependencies) ,
245244 codemap_import_info : RwLock :: new ( vec ! [ ] ) ,
246- attribute_cache : Lock :: new ( [ Vec :: new ( ) , Vec :: new ( ) ] ) ,
247245 dep_kind : Lock :: new ( dep_kind) ,
248246 source : cstore:: CrateSource {
249247 dylib,
250248 rlib,
251249 rmeta,
252- } ,
250+ }
253251 } ;
254252
255253 let cmeta = Lrc :: new ( cmeta) ;
@@ -345,7 +343,7 @@ impl<'a> CrateLoader<'a> {
345343 if locate_ctxt. triple == & self . sess . opts . target_triple {
346344 let mut result = LoadResult :: Loaded ( library) ;
347345 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 {
349347 assert ! ( locate_ctxt. hash. is_none( ) ) ;
350348 info ! ( "load success, going to previous cnum: {}" , cnum) ;
351349 result = LoadResult :: Previous ( cnum) ;
@@ -642,15 +640,14 @@ impl<'a> CrateLoader<'a> {
642640 let mut needs_panic_runtime = attr:: contains_name ( & krate. attrs ,
643641 "needs_panic_runtime" ) ;
644642
645- let sess = self . sess ;
646643 self . cstore . iter_crate_data ( |cnum, data| {
647644 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 {
650647 // Inject a dependency from all #![needs_panic_runtime] to this
651648 // #![panic_runtime] crate.
652649 self . inject_dependency_if ( cnum, "a panic runtime" ,
653- & |data| data. needs_panic_runtime ( sess ) ) ;
650+ & |data| data. root . needs_panic_runtime ) ;
654651 runtime_found = runtime_found || * data. dep_kind . lock ( ) == DepKind :: Explicit ;
655652 }
656653 } ) ;
@@ -687,19 +684,19 @@ impl<'a> CrateLoader<'a> {
687684
688685 // Sanity check the loaded crate to ensure it is indeed a panic runtime
689686 // 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 {
691688 self . sess . err ( & format ! ( "the crate `{}` is not a panic runtime" ,
692689 name) ) ;
693690 }
694- if data. panic_strategy ( ) != desired_strategy {
691+ if data. root . panic_strategy != desired_strategy {
695692 self . sess . err ( & format ! ( "the crate `{}` does not have the panic \
696693 strategy `{}`",
697694 name, desired_strategy. desc( ) ) ) ;
698695 }
699696
700697 self . sess . injected_panic_runtime . set ( Some ( cnum) ) ;
701698 self . inject_dependency_if ( cnum, "a panic runtime" ,
702- & |data| data. needs_panic_runtime ( self . sess ) ) ;
699+ & |data| data. root . needs_panic_runtime ) ;
703700 }
704701
705702 fn inject_sanitizer_runtime ( & mut self ) {
@@ -794,7 +791,7 @@ impl<'a> CrateLoader<'a> {
794791 PathKind :: Crate , dep_kind) ;
795792
796793 // 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 {
798795 self . sess . err ( & format ! ( "the crate `{}` is not a sanitizer runtime" ,
799796 name) ) ;
800797 }
@@ -817,7 +814,7 @@ impl<'a> CrateLoader<'a> {
817814 PathKind :: Crate , dep_kind) ;
818815
819816 // 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 {
821818 self . sess . err ( & format ! ( "the crate `profiler_builtins` is not \
822819 a profiler runtime") ) ;
823820 }
@@ -834,7 +831,7 @@ impl<'a> CrateLoader<'a> {
834831 let mut needs_allocator = attr:: contains_name ( & krate. attrs ,
835832 "needs_allocator" ) ;
836833 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 ;
838835 } ) ;
839836 if !needs_allocator {
840837 self . sess . injected_allocator . set ( None ) ;
@@ -876,7 +873,7 @@ impl<'a> CrateLoader<'a> {
876873 None
877874 } ;
878875 self . cstore . iter_crate_data ( |_, data| {
879- if !data. has_global_allocator ( ) {
876+ if !data. root . has_global_allocator {
880877 return
881878 }
882879 match global_allocator {
@@ -885,14 +882,14 @@ impl<'a> CrateLoader<'a> {
885882 conflicts with this global \
886883 allocator in: {}",
887884 other_crate,
888- data. name( ) ) ) ;
885+ data. root . name) ) ;
889886 }
890887 Some ( None ) => {
891888 self . sess . err ( & format ! ( "the #[global_allocator] in this \
892889 crate conflicts with global \
893- allocator in: {}", data. name( ) ) ) ;
890+ allocator in: {}", data. root . name) ) ;
894891 }
895- None => global_allocator = Some ( Some ( data. name ( ) ) ) ,
892+ None => global_allocator = Some ( Some ( data. root . name ) ) ,
896893 }
897894 } ) ;
898895 if global_allocator. is_some ( ) {
@@ -954,7 +951,7 @@ impl<'a> CrateLoader<'a> {
954951 // error.
955952 let mut allocator = None ;
956953 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 {
958955 allocator = Some ( data. clone ( ) ) ;
959956 }
960957 } ) ;
@@ -1030,9 +1027,9 @@ impl<'a> CrateLoader<'a> {
10301027 self . sess . err ( & format ! ( "the crate `{}` cannot depend \
10311028 on a crate that needs {}, but \
10321029 it depends on `{}`",
1033- self . cstore. get_crate_data( krate) . name( ) ,
1030+ self . cstore. get_crate_data( krate) . root . name,
10341031 what,
1035- data. name( ) ) ) ;
1032+ data. root . name) ) ;
10361033 }
10371034 }
10381035
0 commit comments