@@ -47,9 +47,9 @@ pub struct CrateLoader<'a> {
47
47
fn dump_crates ( cstore : & CStore ) {
48
48
info ! ( "resolved crates:" ) ;
49
49
cstore. iter_crate_data ( |cnum, data| {
50
- info ! ( " name: {}" , data. root. name) ;
50
+ info ! ( " name: {}" , data. root. name( ) ) ;
51
51
info ! ( " cnum: {}" , cnum) ;
52
- info ! ( " hash: {}" , data. root. hash) ;
52
+ info ! ( " hash: {}" , data. root. hash( ) ) ;
53
53
info ! ( " reqd: {:?}" , data. dep_kind( ) ) ;
54
54
let CrateSource { dylib, rlib, rmeta } = data. source ( ) ;
55
55
dylib. as_ref ( ) . map ( |dl| info ! ( " dylib: {}" , dl. 0 . display( ) ) ) ;
@@ -101,10 +101,10 @@ impl<'a> CrateLoader<'a> {
101
101
-> Option < CrateNum > {
102
102
let mut ret = None ;
103
103
self . cstore . iter_crate_data ( |cnum, data| {
104
- if data. root . name != name { return }
104
+ if data. root . name ( ) != name { return }
105
105
106
106
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 }
108
108
Some ( ..) => return ,
109
109
None => { }
110
110
}
@@ -152,26 +152,26 @@ impl<'a> CrateLoader<'a> {
152
152
span : Span ,
153
153
root : & CrateRoot < ' _ > ) {
154
154
// 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 ( ) {
157
157
span_fatal ! ( self . sess, span, E0519 ,
158
158
"the current crate is indistinguishable from one of its \
159
159
dependencies: it has the same crate-name `{}` and was \
160
160
compiled with the same `-C metadata` arguments. This \
161
161
will result in symbol conflicts between the two.",
162
- root. name)
162
+ root. name( ) )
163
163
}
164
164
165
165
// Check for conflicts with any crate loaded so far
166
166
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
170
170
span_fatal ! ( self . sess, span, E0523 ,
171
171
"found two different crates with name `{}` that are \
172
172
not distinguished by differing `-C metadata`. This \
173
173
will result in symbol conflicts between the two.",
174
- root. name)
174
+ root. name( ) )
175
175
}
176
176
} ) ;
177
177
}
@@ -189,14 +189,14 @@ impl<'a> CrateLoader<'a> {
189
189
190
190
let Library { source, metadata } = lib;
191
191
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 ( ) ) ;
193
193
self . verify_no_symbol_conflicts ( span, & crate_root) ;
194
194
195
195
let private_dep = self . sess . opts . externs . get ( & name. as_str ( ) )
196
196
. map ( |e| e. is_private_dep )
197
197
. unwrap_or ( false ) ;
198
198
199
- info ! ( "register crate `{}` (private_dep = {})" , crate_root. name, private_dep) ;
199
+ info ! ( "register crate `{}` (private_dep = {})" , crate_root. name( ) , private_dep) ;
200
200
201
201
// Claim this crate number and cache it
202
202
let cnum = self . cstore . alloc_new_crate_num ( ) ;
@@ -207,7 +207,7 @@ impl<'a> CrateLoader<'a> {
207
207
let root = if let Some ( root) = root {
208
208
root
209
209
} else {
210
- crate_paths = CratePaths :: new ( crate_root. name , source. clone ( ) ) ;
210
+ crate_paths = CratePaths :: new ( crate_root. name ( ) , source. clone ( ) ) ;
211
211
& crate_paths
212
212
} ;
213
213
@@ -221,7 +221,7 @@ impl<'a> CrateLoader<'a> {
221
221
None => ( & source, & crate_root) ,
222
222
} ;
223
223
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) )
225
225
} else {
226
226
None
227
227
} ;
@@ -378,7 +378,7 @@ impl<'a> CrateLoader<'a> {
378
378
if locator. triple == self . sess . opts . target_triple {
379
379
let mut result = LoadResult :: Loaded ( library) ;
380
380
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 ( ) {
382
382
assert ! ( locator. hash. is_none( ) ) ;
383
383
info ! ( "load success, going to previous cnum: {}" , cnum) ;
384
384
result = LoadResult :: Previous ( cnum) ;
@@ -494,13 +494,12 @@ impl<'a> CrateLoader<'a> {
494
494
sym:: needs_panic_runtime) ;
495
495
496
496
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 ( ) {
500
499
// Inject a dependency from all #![needs_panic_runtime] to this
501
500
// #![panic_runtime] crate.
502
501
self . inject_dependency_if ( cnum, "a panic runtime" ,
503
- & |data| data. root . needs_panic_runtime ) ;
502
+ & |data| data. needs_panic_runtime ( ) ) ;
504
503
runtime_found = runtime_found || data. dep_kind ( ) == DepKind :: Explicit ;
505
504
}
506
505
} ) ;
@@ -536,19 +535,19 @@ impl<'a> CrateLoader<'a> {
536
535
537
536
// Sanity check the loaded crate to ensure it is indeed a panic runtime
538
537
// and the panic strategy is indeed what we thought it was.
539
- if !data. root . panic_runtime {
538
+ if !data. is_panic_runtime ( ) {
540
539
self . sess . err ( & format ! ( "the crate `{}` is not a panic runtime" ,
541
540
name) ) ;
542
541
}
543
- if data. root . panic_strategy != desired_strategy {
542
+ if data. panic_strategy ( ) != desired_strategy {
544
543
self . sess . err ( & format ! ( "the crate `{}` does not have the panic \
545
544
strategy `{}`",
546
545
name, desired_strategy. desc( ) ) ) ;
547
546
}
548
547
549
548
self . cstore . injected_panic_runtime = Some ( cnum) ;
550
549
self . inject_dependency_if ( cnum, "a panic runtime" ,
551
- & |data| data. root . needs_panic_runtime ) ;
550
+ & |data| data. needs_panic_runtime ( ) ) ;
552
551
}
553
552
554
553
fn inject_sanitizer_runtime ( & mut self ) {
@@ -622,7 +621,7 @@ impl<'a> CrateLoader<'a> {
622
621
623
622
let mut uses_std = false ;
624
623
self . cstore . iter_crate_data ( |_, data| {
625
- if data. root . name == sym:: std {
624
+ if data. root . name ( ) == sym:: std {
626
625
uses_std = true ;
627
626
}
628
627
} ) ;
@@ -640,7 +639,7 @@ impl<'a> CrateLoader<'a> {
640
639
let data = self . cstore . get_crate_data ( cnum) ;
641
640
642
641
// 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 ( ) {
644
643
self . sess . err ( & format ! ( "the crate `{}` is not a sanitizer runtime" ,
645
644
name) ) ;
646
645
}
@@ -661,7 +660,7 @@ impl<'a> CrateLoader<'a> {
661
660
let data = self . cstore . get_crate_data ( cnum) ;
662
661
663
662
// 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 ( ) {
665
664
self . sess . err ( & format ! ( "the crate `profiler_builtins` is not \
666
665
a profiler runtime") ) ;
667
666
}
@@ -687,7 +686,7 @@ impl<'a> CrateLoader<'a> {
687
686
let mut needs_allocator = attr:: contains_name ( & krate. attrs ,
688
687
sym:: needs_allocator) ;
689
688
self . cstore . iter_crate_data ( |_, data| {
690
- needs_allocator = needs_allocator || data. root . needs_allocator ;
689
+ needs_allocator = needs_allocator || data. needs_allocator ( ) ;
691
690
} ) ;
692
691
if !needs_allocator {
693
692
self . cstore . allocator_kind = None ;
@@ -723,7 +722,7 @@ impl<'a> CrateLoader<'a> {
723
722
None
724
723
} ;
725
724
self . cstore . iter_crate_data ( |_, data| {
726
- if !data. root . has_global_allocator {
725
+ if !data. has_global_allocator ( ) {
727
726
return
728
727
}
729
728
match global_allocator {
@@ -732,14 +731,14 @@ impl<'a> CrateLoader<'a> {
732
731
conflicts with this global \
733
732
allocator in: {}",
734
733
other_crate,
735
- data. root. name) ) ;
734
+ data. root. name( ) ) ) ;
736
735
}
737
736
Some ( None ) => {
738
737
self . sess . err ( & format ! ( "the `#[global_allocator]` in this \
739
738
crate conflicts with global \
740
- allocator in: {}", data. root. name) ) ;
739
+ allocator in: {}", data. root. name( ) ) ) ;
741
740
}
742
- None => global_allocator = Some ( Some ( data. root . name ) ) ,
741
+ None => global_allocator = Some ( Some ( data. root . name ( ) ) ) ,
743
742
}
744
743
} ) ;
745
744
if global_allocator. is_some ( ) {
@@ -753,7 +752,7 @@ impl<'a> CrateLoader<'a> {
753
752
// attribute.
754
753
let mut has_default = attr:: contains_name ( & krate. attrs , sym:: default_lib_allocator) ;
755
754
self . cstore . iter_crate_data ( |_, data| {
756
- if data. root . has_default_lib_allocator {
755
+ if data. has_default_lib_allocator ( ) {
757
756
has_default = true ;
758
757
}
759
758
} ) ;
@@ -787,9 +786,9 @@ impl<'a> CrateLoader<'a> {
787
786
self . sess . err ( & format ! ( "the crate `{}` cannot depend \
788
787
on a crate that needs {}, but \
789
788
it depends on `{}`",
790
- self . cstore. get_crate_data( krate) . root. name,
789
+ self . cstore. get_crate_data( krate) . root. name( ) ,
791
790
what,
792
- data. root. name) ) ;
791
+ data. root. name( ) ) ) ;
793
792
}
794
793
}
795
794
0 commit comments