@@ -450,6 +450,7 @@ impl<'a> CrateLoader<'a> {
450
450
& self ,
451
451
locator : & mut CrateLocator < ' b > ,
452
452
path_kind : PathKind ,
453
+ host_hash : Option < Svh > ,
453
454
) -> Result < Option < ( LoadResult , Option < Library > ) > , CrateError >
454
455
where
455
456
' a : ' b ,
@@ -459,7 +460,7 @@ impl<'a> CrateLoader<'a> {
459
460
let mut proc_macro_locator = locator. clone ( ) ;
460
461
461
462
// Try to load a proc macro
462
- proc_macro_locator. is_proc_macro = Some ( true ) ;
463
+ proc_macro_locator. is_proc_macro = true ;
463
464
464
465
// Load the proc macro crate for the target
465
466
let ( locator, target_result) = if self . sess . opts . debugging_opts . dual_proc_macros {
@@ -471,7 +472,7 @@ impl<'a> CrateLoader<'a> {
471
472
Some ( LoadResult :: Loaded ( library) ) => Some ( LoadResult :: Loaded ( library) ) ,
472
473
None => return Ok ( None ) ,
473
474
} ;
474
- locator. hash = locator . host_hash ;
475
+ locator. hash = host_hash;
475
476
// Use the locator when looking for the host proc macro crate, as that is required
476
477
// so we want it to affect the error message
477
478
( locator, result)
@@ -482,7 +483,7 @@ impl<'a> CrateLoader<'a> {
482
483
// Load the proc macro crate for the host
483
484
484
485
locator. reset ( ) ;
485
- locator. is_proc_macro = Some ( true ) ;
486
+ locator. is_proc_macro = true ;
486
487
locator. target = & self . sess . host ;
487
488
locator. triple = TargetTriple :: from_triple ( config:: host_triple ( ) ) ;
488
489
locator. filesearch = self . sess . host_filesearch ( path_kind) ;
@@ -510,12 +511,9 @@ impl<'a> CrateLoader<'a> {
510
511
name : Symbol ,
511
512
span : Span ,
512
513
dep_kind : CrateDepKind ,
513
- dep : Option < ( & ' b CratePaths , & ' b CrateDep ) > ,
514
514
) -> CrateNum {
515
- if dep. is_none ( ) {
516
- self . used_extern_options . insert ( name) ;
517
- }
518
- self . maybe_resolve_crate ( name, dep_kind, dep) . unwrap_or_else ( |err| {
515
+ self . used_extern_options . insert ( name) ;
516
+ self . maybe_resolve_crate ( name, dep_kind, None ) . unwrap_or_else ( |err| {
519
517
let missing_core =
520
518
self . maybe_resolve_crate ( sym:: core, CrateDepKind :: Explicit , None ) . is_err ( ) ;
521
519
err. report ( & self . sess , span, missing_core)
@@ -551,21 +549,18 @@ impl<'a> CrateLoader<'a> {
551
549
& * self . metadata_loader ,
552
550
name,
553
551
hash,
554
- host_hash,
555
552
extra_filename,
556
553
false , // is_host
557
554
path_kind,
558
- root,
559
- Some ( false ) , // is_proc_macro
560
555
) ;
561
556
562
557
match self . load ( & mut locator) ? {
563
558
Some ( res) => ( res, None ) ,
564
559
None => {
565
560
dep_kind = CrateDepKind :: MacrosOnly ;
566
- match self . load_proc_macro ( & mut locator, path_kind) ? {
561
+ match self . load_proc_macro ( & mut locator, path_kind, host_hash ) ? {
567
562
Some ( res) => res,
568
- None => return Err ( locator. into_error ( ) ) ,
563
+ None => return Err ( locator. into_error ( root . cloned ( ) ) ) ,
569
564
}
570
565
}
571
566
}
@@ -605,7 +600,7 @@ impl<'a> CrateLoader<'a> {
605
600
// FIXME: why is this condition necessary? It was adding in #33625 but I
606
601
// don't know why and the original author doesn't remember ...
607
602
let can_reuse_cratenum =
608
- locator. triple == self . sess . opts . target_triple || locator. is_proc_macro == Some ( true ) ;
603
+ locator. triple == self . sess . opts . target_triple || locator. is_proc_macro ;
609
604
Ok ( Some ( if can_reuse_cratenum {
610
605
let mut result = LoadResult :: Loaded ( library) ;
611
606
self . cstore . iter_crate_data ( |cnum, data| {
@@ -755,7 +750,7 @@ impl<'a> CrateLoader<'a> {
755
750
} ;
756
751
info ! ( "panic runtime not found -- loading {}" , name) ;
757
752
758
- let cnum = self . resolve_crate ( name, DUMMY_SP , CrateDepKind :: Implicit , None ) ;
753
+ let cnum = self . resolve_crate ( name, DUMMY_SP , CrateDepKind :: Implicit ) ;
759
754
let data = self . cstore . get_crate_data ( cnum) ;
760
755
761
756
// Sanity check the loaded crate to ensure it is indeed a panic runtime
@@ -795,7 +790,7 @@ impl<'a> CrateLoader<'a> {
795
790
) ;
796
791
}
797
792
798
- let cnum = self . resolve_crate ( name, DUMMY_SP , CrateDepKind :: Implicit , None ) ;
793
+ let cnum = self . resolve_crate ( name, DUMMY_SP , CrateDepKind :: Implicit ) ;
799
794
let data = self . cstore . get_crate_data ( cnum) ;
800
795
801
796
// Sanity check the loaded crate to ensure it is indeed a profiler runtime
@@ -1015,7 +1010,7 @@ impl<'a> CrateLoader<'a> {
1015
1010
CrateDepKind :: Explicit
1016
1011
} ;
1017
1012
1018
- let cnum = self . resolve_crate ( name, item. span , dep_kind, None ) ;
1013
+ let cnum = self . resolve_crate ( name, item. span , dep_kind) ;
1019
1014
1020
1015
let path_len = definitions. def_path ( def_id) . data . len ( ) ;
1021
1016
self . update_extern_crate (
@@ -1034,7 +1029,7 @@ impl<'a> CrateLoader<'a> {
1034
1029
}
1035
1030
1036
1031
pub fn process_path_extern ( & mut self , name : Symbol , span : Span ) -> CrateNum {
1037
- let cnum = self . resolve_crate ( name, span, CrateDepKind :: Explicit , None ) ;
1032
+ let cnum = self . resolve_crate ( name, span, CrateDepKind :: Explicit ) ;
1038
1033
1039
1034
self . update_extern_crate (
1040
1035
cnum,
0 commit comments