@@ -24,16 +24,15 @@ use rustc_middle::ty::data_structures::IndexSet;
24
24
use rustc_middle:: ty:: { TyCtxt , TyCtxtFeed } ;
25
25
use rustc_proc_macro:: bridge:: client:: ProcMacro ;
26
26
use rustc_session:: config:: {
27
- self , CrateType , ExtendedTargetModifierInfo , ExternLocation , OptionsTargetModifiers ,
28
- TargetModifier ,
27
+ CrateType , ExtendedTargetModifierInfo , ExternLocation , OptionsTargetModifiers , TargetModifier ,
29
28
} ;
30
29
use rustc_session:: cstore:: { CrateDepKind , CrateSource , ExternCrate , ExternCrateSource } ;
31
30
use rustc_session:: lint:: { self , BuiltinLintDiag } ;
32
31
use rustc_session:: output:: validate_crate_name;
33
32
use rustc_session:: search_paths:: PathKind ;
34
33
use rustc_span:: edition:: Edition ;
35
34
use rustc_span:: { DUMMY_SP , Ident , Span , Symbol , sym} ;
36
- use rustc_target:: spec:: { PanicStrategy , Target , TargetTuple } ;
35
+ use rustc_target:: spec:: { PanicStrategy , Target } ;
37
36
use tracing:: { debug, info, trace} ;
38
37
39
38
use crate :: errors;
@@ -697,7 +696,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
697
696
let mut proc_macro_locator = locator. clone ( ) ;
698
697
699
698
// Try to load a proc macro
700
- proc_macro_locator. is_proc_macro = true ;
699
+ proc_macro_locator. for_target_proc_macro ( self . sess , path_kind ) ;
701
700
702
701
// Load the proc macro crate for the target
703
702
let target_result =
@@ -709,17 +708,12 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
709
708
None => return Ok ( None ) ,
710
709
} ;
711
710
712
- // Load the proc macro crate for the host
713
-
714
711
// Use the existing crate_rejections as we want the error message to be affected by
715
712
// loading the host proc macro.
716
713
* crate_rejections = CrateRejections :: default ( ) ;
717
- // FIXME use a separate CrateLocator for the host rather than mutating the target CrateLocator
718
- locator. is_proc_macro = true ;
719
- locator. target = & self . sess . host ;
720
- locator. tuple = TargetTuple :: from_tuple ( config:: host_tuple ( ) ) ;
721
- locator. filesearch = self . sess . host_filesearch ( ) ;
722
- locator. path_kind = path_kind;
714
+
715
+ // Load the proc macro crate for the host
716
+ locator. for_proc_macro ( self . sess , path_kind) ;
723
717
724
718
locator. hash = host_hash;
725
719
@@ -739,16 +733,8 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
739
733
// affect the error message we emit
740
734
let mut proc_macro_locator = locator. clone ( ) ;
741
735
742
- // Try to load a proc macro
743
- proc_macro_locator. is_proc_macro = true ;
744
-
745
736
// Load the proc macro crate for the host
746
-
747
- // FIXME use a separate CrateLocator for the host rather than mutating the target CrateLocator
748
- proc_macro_locator. target = & self . sess . host ;
749
- proc_macro_locator. tuple = TargetTuple :: from_tuple ( config:: host_tuple ( ) ) ;
750
- proc_macro_locator. filesearch = self . sess . host_filesearch ( ) ;
751
- proc_macro_locator. path_kind = path_kind;
737
+ proc_macro_locator. for_proc_macro ( self . sess , path_kind) ;
752
738
753
739
let Some ( host_result) =
754
740
self . load ( & mut proc_macro_locator, & mut CrateRejections :: default ( ) ) ?
0 commit comments