@@ -47,9 +47,9 @@ pub struct CrateLoader<'a> {
4747fn dump_crates ( cstore : & CStore ) {
4848 info ! ( "resolved crates:" ) ;
4949 cstore. iter_crate_data ( |cnum, data| {
50- info ! ( " name: {}" , data. root. name) ;
50+ info ! ( " name: {}" , data. root. name( ) ) ;
5151 info ! ( " cnum: {}" , cnum) ;
52- info ! ( " hash: {}" , data. root. hash) ;
52+ info ! ( " hash: {}" , data. root. hash( ) ) ;
5353 info ! ( " reqd: {:?}" , data. dep_kind( ) ) ;
5454 let CrateSource { dylib, rlib, rmeta } = data. source ( ) ;
5555 dylib. as_ref ( ) . map ( |dl| info ! ( " dylib: {}" , dl. 0 . display( ) ) ) ;
@@ -101,10 +101,10 @@ impl<'a> CrateLoader<'a> {
101101 -> Option < CrateNum > {
102102 let mut ret = None ;
103103 self . cstore . iter_crate_data ( |cnum, data| {
104- if data. root . name != name { return }
104+ if data. root . name ( ) != name { return }
105105
106106 match hash {
107- Some ( hash) if * hash == data. root . hash => { ret = Some ( cnum) ; return }
107+ Some ( hash) if * hash == data. root . hash ( ) => { ret = Some ( cnum) ; return }
108108 Some ( ..) => return ,
109109 None => { }
110110 }
@@ -152,26 +152,26 @@ impl<'a> CrateLoader<'a> {
152152 span : Span ,
153153 root : & CrateRoot < ' _ > ) {
154154 // Check for (potential) conflicts with the local crate
155- if self . local_crate_name == root. name &&
156- self . sess . local_crate_disambiguator ( ) == root. disambiguator {
155+ if self . local_crate_name == root. name ( ) &&
156+ self . sess . local_crate_disambiguator ( ) == root. disambiguator ( ) {
157157 span_fatal ! ( self . sess, span, E0519 ,
158158 "the current crate is indistinguishable from one of its \
159159 dependencies: it has the same crate-name `{}` and was \
160160 compiled with the same `-C metadata` arguments. This \
161161 will result in symbol conflicts between the two.",
162- root. name)
162+ root. name( ) )
163163 }
164164
165165 // Check for conflicts with any crate loaded so far
166166 self . cstore . iter_crate_data ( |_, other| {
167- if other. root . name == root. name && // same crate-name
168- other. root . disambiguator == root. disambiguator && // same crate-disambiguator
169- other. root . hash != root. hash { // but different SVH
167+ if other. root . name ( ) == root. name ( ) && // same crate-name
168+ other. root . disambiguator ( ) == root. disambiguator ( ) && // same crate-disambiguator
169+ other. root . hash ( ) != root. hash ( ) { // but different SVH
170170 span_fatal ! ( self . sess, span, E0523 ,
171171 "found two different crates with name `{}` that are \
172172 not distinguished by differing `-C metadata`. This \
173173 will result in symbol conflicts between the two.",
174- root. name)
174+ root. name( ) )
175175 }
176176 } ) ;
177177 }
@@ -189,14 +189,14 @@ impl<'a> CrateLoader<'a> {
189189
190190 let Library { source, metadata } = lib;
191191 let crate_root = metadata. get_root ( ) ;
192- let host_hash = host_lib. as_ref ( ) . map ( |lib| lib. metadata . get_root ( ) . hash ) ;
192+ let host_hash = host_lib. as_ref ( ) . map ( |lib| lib. metadata . get_root ( ) . hash ( ) ) ;
193193 self . verify_no_symbol_conflicts ( span, & crate_root) ;
194194
195195 let private_dep = self . sess . opts . externs . get ( & name. as_str ( ) )
196196 . map ( |e| e. is_private_dep )
197197 . unwrap_or ( false ) ;
198198
199- info ! ( "register crate `{}` (private_dep = {})" , crate_root. name, private_dep) ;
199+ info ! ( "register crate `{}` (private_dep = {})" , crate_root. name( ) , private_dep) ;
200200
201201 // Claim this crate number and cache it
202202 let cnum = self . cstore . alloc_new_crate_num ( ) ;
@@ -207,7 +207,7 @@ impl<'a> CrateLoader<'a> {
207207 let root = if let Some ( root) = root {
208208 root
209209 } else {
210- crate_paths = CratePaths :: new ( crate_root. name , source. clone ( ) ) ;
210+ crate_paths = CratePaths :: new ( crate_root. name ( ) , source. clone ( ) ) ;
211211 & crate_paths
212212 } ;
213213
@@ -221,7 +221,7 @@ impl<'a> CrateLoader<'a> {
221221 None => ( & source, & crate_root) ,
222222 } ;
223223 let dlsym_dylib = dlsym_source. dylib . as_ref ( ) . expect ( "no dylib for a proc-macro crate" ) ;
224- Some ( self . dlsym_proc_macros ( & dlsym_dylib. 0 , dlsym_root. disambiguator , span) )
224+ Some ( self . dlsym_proc_macros ( & dlsym_dylib. 0 , dlsym_root. disambiguator ( ) , span) )
225225 } else {
226226 None
227227 } ;
@@ -378,7 +378,7 @@ impl<'a> CrateLoader<'a> {
378378 if locator. triple == self . sess . opts . target_triple {
379379 let mut result = LoadResult :: Loaded ( library) ;
380380 self . cstore . iter_crate_data ( |cnum, data| {
381- if data. root . name == root. name && root. hash == data. root . hash {
381+ if data. root . name ( ) == root. name ( ) && root. hash ( ) == data. root . hash ( ) {
382382 assert ! ( locator. hash. is_none( ) ) ;
383383 info ! ( "load success, going to previous cnum: {}" , cnum) ;
384384 result = LoadResult :: Previous ( cnum) ;
@@ -494,13 +494,12 @@ impl<'a> CrateLoader<'a> {
494494 sym:: needs_panic_runtime) ;
495495
496496 self . cstore . iter_crate_data ( |cnum, data| {
497- needs_panic_runtime = needs_panic_runtime ||
498- data. root . needs_panic_runtime ;
499- if data. root . panic_runtime {
497+ needs_panic_runtime = needs_panic_runtime || data. needs_panic_runtime ( ) ;
498+ if data. is_panic_runtime ( ) {
500499 // Inject a dependency from all #![needs_panic_runtime] to this
501500 // #![panic_runtime] crate.
502501 self . inject_dependency_if ( cnum, "a panic runtime" ,
503- & |data| data. root . needs_panic_runtime ) ;
502+ & |data| data. needs_panic_runtime ( ) ) ;
504503 runtime_found = runtime_found || data. dep_kind ( ) == DepKind :: Explicit ;
505504 }
506505 } ) ;
@@ -536,19 +535,19 @@ impl<'a> CrateLoader<'a> {
536535
537536 // Sanity check the loaded crate to ensure it is indeed a panic runtime
538537 // and the panic strategy is indeed what we thought it was.
539- if !data. root . panic_runtime {
538+ if !data. is_panic_runtime ( ) {
540539 self . sess . err ( & format ! ( "the crate `{}` is not a panic runtime" ,
541540 name) ) ;
542541 }
543- if data. root . panic_strategy != desired_strategy {
542+ if data. panic_strategy ( ) != desired_strategy {
544543 self . sess . err ( & format ! ( "the crate `{}` does not have the panic \
545544 strategy `{}`",
546545 name, desired_strategy. desc( ) ) ) ;
547546 }
548547
549548 self . cstore . injected_panic_runtime = Some ( cnum) ;
550549 self . inject_dependency_if ( cnum, "a panic runtime" ,
551- & |data| data. root . needs_panic_runtime ) ;
550+ & |data| data. needs_panic_runtime ( ) ) ;
552551 }
553552
554553 fn inject_sanitizer_runtime ( & mut self ) {
@@ -622,7 +621,7 @@ impl<'a> CrateLoader<'a> {
622621
623622 let mut uses_std = false ;
624623 self . cstore . iter_crate_data ( |_, data| {
625- if data. root . name == sym:: std {
624+ if data. root . name ( ) == sym:: std {
626625 uses_std = true ;
627626 }
628627 } ) ;
@@ -640,7 +639,7 @@ impl<'a> CrateLoader<'a> {
640639 let data = self . cstore . get_crate_data ( cnum) ;
641640
642641 // Sanity check the loaded crate to ensure it is indeed a sanitizer runtime
643- if !data. root . sanitizer_runtime {
642+ if !data. is_sanitizer_runtime ( ) {
644643 self . sess . err ( & format ! ( "the crate `{}` is not a sanitizer runtime" ,
645644 name) ) ;
646645 }
@@ -661,7 +660,7 @@ impl<'a> CrateLoader<'a> {
661660 let data = self . cstore . get_crate_data ( cnum) ;
662661
663662 // Sanity check the loaded crate to ensure it is indeed a profiler runtime
664- if !data. root . profiler_runtime {
663+ if !data. is_profiler_runtime ( ) {
665664 self . sess . err ( & format ! ( "the crate `profiler_builtins` is not \
666665 a profiler runtime") ) ;
667666 }
@@ -687,7 +686,7 @@ impl<'a> CrateLoader<'a> {
687686 let mut needs_allocator = attr:: contains_name ( & krate. attrs ,
688687 sym:: needs_allocator) ;
689688 self . cstore . iter_crate_data ( |_, data| {
690- needs_allocator = needs_allocator || data. root . needs_allocator ;
689+ needs_allocator = needs_allocator || data. needs_allocator ( ) ;
691690 } ) ;
692691 if !needs_allocator {
693692 self . cstore . allocator_kind = None ;
@@ -723,7 +722,7 @@ impl<'a> CrateLoader<'a> {
723722 None
724723 } ;
725724 self . cstore . iter_crate_data ( |_, data| {
726- if !data. root . has_global_allocator {
725+ if !data. has_global_allocator ( ) {
727726 return
728727 }
729728 match global_allocator {
@@ -732,14 +731,14 @@ impl<'a> CrateLoader<'a> {
732731 conflicts with this global \
733732 allocator in: {}",
734733 other_crate,
735- data. root. name) ) ;
734+ data. root. name( ) ) ) ;
736735 }
737736 Some ( None ) => {
738737 self . sess . err ( & format ! ( "the `#[global_allocator]` in this \
739738 crate conflicts with global \
740- allocator in: {}", data. root. name) ) ;
739+ allocator in: {}", data. root. name( ) ) ) ;
741740 }
742- None => global_allocator = Some ( Some ( data. root . name ) ) ,
741+ None => global_allocator = Some ( Some ( data. root . name ( ) ) ) ,
743742 }
744743 } ) ;
745744 if global_allocator. is_some ( ) {
@@ -753,7 +752,7 @@ impl<'a> CrateLoader<'a> {
753752 // attribute.
754753 let mut has_default = attr:: contains_name ( & krate. attrs , sym:: default_lib_allocator) ;
755754 self . cstore . iter_crate_data ( |_, data| {
756- if data. root . has_default_lib_allocator {
755+ if data. has_default_lib_allocator ( ) {
757756 has_default = true ;
758757 }
759758 } ) ;
@@ -787,9 +786,9 @@ impl<'a> CrateLoader<'a> {
787786 self . sess . err ( & format ! ( "the crate `{}` cannot depend \
788787 on a crate that needs {}, but \
789788 it depends on `{}`",
790- self . cstore. get_crate_data( krate) . root. name,
789+ self . cstore. get_crate_data( krate) . root. name( ) ,
791790 what,
792- data. root. name) ) ;
791+ data. root. name( ) ) ) ;
793792 }
794793 }
795794
0 commit comments