@@ -187,7 +187,7 @@ impl<'a> CrateLoader<'a> {
187
187
}
188
188
189
189
fn register_crate (
190
- & mut self ,
190
+ & self ,
191
191
host_lib : Option < Library > ,
192
192
root : Option < & CratePaths > ,
193
193
span : Span ,
@@ -272,7 +272,7 @@ impl<'a> CrateLoader<'a> {
272
272
}
273
273
274
274
fn load_proc_macro < ' b > (
275
- & mut self ,
275
+ & self ,
276
276
locate_ctxt : & mut locator:: Context < ' b > ,
277
277
path_kind : PathKind ,
278
278
) -> Option < ( LoadResult , Option < Library > ) >
@@ -327,7 +327,7 @@ impl<'a> CrateLoader<'a> {
327
327
}
328
328
329
329
fn resolve_crate < ' b > (
330
- & ' b mut self ,
330
+ & ' b self ,
331
331
name : Symbol ,
332
332
span : Span ,
333
333
dep_kind : DepKind ,
@@ -337,7 +337,7 @@ impl<'a> CrateLoader<'a> {
337
337
}
338
338
339
339
fn maybe_resolve_crate < ' b > (
340
- & ' b mut self ,
340
+ & ' b self ,
341
341
name : Symbol ,
342
342
span : Span ,
343
343
mut dep_kind : DepKind ,
@@ -397,7 +397,7 @@ impl<'a> CrateLoader<'a> {
397
397
}
398
398
}
399
399
400
- fn load ( & mut self , locate_ctxt : & mut locator:: Context < ' _ > ) -> Option < LoadResult > {
400
+ fn load ( & self , locate_ctxt : & mut locator:: Context < ' _ > ) -> Option < LoadResult > {
401
401
let library = locate_ctxt. maybe_load_library_crate ( ) ?;
402
402
403
403
// In the case that we're loading a crate, but not matching
@@ -424,7 +424,7 @@ impl<'a> CrateLoader<'a> {
424
424
}
425
425
}
426
426
427
- fn update_extern_crate ( & mut self ,
427
+ fn update_extern_crate ( & self ,
428
428
cnum : CrateNum ,
429
429
mut extern_crate : ExternCrate ,
430
430
visited : & mut FxHashSet < ( CrateNum , bool ) > )
@@ -466,7 +466,7 @@ impl<'a> CrateLoader<'a> {
466
466
}
467
467
468
468
// Go through the crate metadata and load any crates that it references
469
- fn resolve_crate_deps ( & mut self ,
469
+ fn resolve_crate_deps ( & self ,
470
470
root : & CratePaths ,
471
471
crate_root : & CrateRoot < ' _ > ,
472
472
metadata : & MetadataBlob ,
@@ -496,7 +496,7 @@ impl<'a> CrateLoader<'a> {
496
496
} ) ) . collect ( )
497
497
}
498
498
499
- fn read_extension_crate ( & mut self , name : Symbol , span : Span ) -> ExtensionCrate {
499
+ fn read_extension_crate ( & self , name : Symbol , span : Span ) -> ExtensionCrate {
500
500
info ! ( "read extension crate `{}`" , name) ;
501
501
let target_triple = self . sess . opts . target_triple . clone ( ) ;
502
502
let host_triple = TargetTriple :: from_triple ( config:: host_triple ( ) ) ;
@@ -592,7 +592,7 @@ impl<'a> CrateLoader<'a> {
592
592
593
593
/// Look for a plugin registrar. Returns library path, crate
594
594
/// SVH and DefIndex of the registrar function.
595
- pub fn find_plugin_registrar ( & mut self ,
595
+ pub fn find_plugin_registrar ( & self ,
596
596
span : Span ,
597
597
name : Symbol )
598
598
-> Option < ( PathBuf , CrateDisambiguator ) > {
@@ -625,7 +625,7 @@ impl<'a> CrateLoader<'a> {
625
625
}
626
626
}
627
627
628
- fn inject_panic_runtime ( & mut self , krate : & ast:: Crate ) {
628
+ fn inject_panic_runtime ( & self , krate : & ast:: Crate ) {
629
629
// If we're only compiling an rlib, then there's no need to select a
630
630
// panic runtime, so we just skip this section entirely.
631
631
let any_non_rlib = self . sess . crate_types . borrow ( ) . iter ( ) . any ( |ct| {
@@ -706,7 +706,7 @@ impl<'a> CrateLoader<'a> {
706
706
& |data| data. root . needs_panic_runtime ) ;
707
707
}
708
708
709
- fn inject_sanitizer_runtime ( & mut self ) {
709
+ fn inject_sanitizer_runtime ( & self ) {
710
710
if let Some ( ref sanitizer) = self . sess . opts . debugging_opts . sanitizer {
711
711
// Sanitizers can only be used on some tested platforms with
712
712
// executables linked to `std`
@@ -804,7 +804,7 @@ impl<'a> CrateLoader<'a> {
804
804
}
805
805
}
806
806
807
- fn inject_profiler_runtime ( & mut self ) {
807
+ fn inject_profiler_runtime ( & self ) {
808
808
if self . sess . opts . debugging_opts . profile ||
809
809
self . sess . opts . cg . profile_generate . enabled ( )
810
810
{
@@ -821,7 +821,7 @@ impl<'a> CrateLoader<'a> {
821
821
}
822
822
}
823
823
824
- fn inject_allocator_crate ( & mut self , krate : & ast:: Crate ) {
824
+ fn inject_allocator_crate ( & self , krate : & ast:: Crate ) {
825
825
let has_global_allocator = match & * global_allocator_spans ( krate) {
826
826
[ span1, span2, ..] => {
827
827
self . sess . struct_span_err ( * span2, "cannot define multiple global allocators" )
@@ -960,7 +960,7 @@ impl<'a> CrateLoader<'a> {
960
960
}
961
961
962
962
impl < ' a > CrateLoader < ' a > {
963
- pub fn postprocess ( & mut self , krate : & ast:: Crate ) {
963
+ pub fn postprocess ( & self , krate : & ast:: Crate ) {
964
964
self . inject_sanitizer_runtime ( ) ;
965
965
self . inject_profiler_runtime ( ) ;
966
966
self . inject_allocator_crate ( krate) ;
@@ -971,9 +971,7 @@ impl<'a> CrateLoader<'a> {
971
971
}
972
972
}
973
973
974
- pub fn process_extern_crate (
975
- & mut self , item : & ast:: Item , definitions : & Definitions ,
976
- ) -> CrateNum {
974
+ pub fn process_extern_crate ( & self , item : & ast:: Item , definitions : & Definitions ) -> CrateNum {
977
975
match item. kind {
978
976
ast:: ItemKind :: ExternCrate ( orig_name) => {
979
977
debug ! ( "resolving extern crate stmt. ident: {} orig_name: {:?}" ,
@@ -1013,11 +1011,7 @@ impl<'a> CrateLoader<'a> {
1013
1011
}
1014
1012
}
1015
1013
1016
- pub fn process_path_extern (
1017
- & mut self ,
1018
- name : Symbol ,
1019
- span : Span ,
1020
- ) -> CrateNum {
1014
+ pub fn process_path_extern ( & self , name : Symbol , span : Span ) -> CrateNum {
1021
1015
let cnum = self . resolve_crate ( name, span, DepKind :: Explicit , None ) . 0 ;
1022
1016
1023
1017
self . update_extern_crate (
@@ -1035,11 +1029,7 @@ impl<'a> CrateLoader<'a> {
1035
1029
cnum
1036
1030
}
1037
1031
1038
- pub fn maybe_process_path_extern (
1039
- & mut self ,
1040
- name : Symbol ,
1041
- span : Span ,
1042
- ) -> Option < CrateNum > {
1032
+ pub fn maybe_process_path_extern ( & self , name : Symbol , span : Span ) -> Option < CrateNum > {
1043
1033
let cnum = self . maybe_resolve_crate ( name, span, DepKind :: Explicit , None ) . ok ( ) ?. 0 ;
1044
1034
1045
1035
self . update_extern_crate (
0 commit comments