@@ -24,16 +24,15 @@ use rustc_middle::ty::data_structures::IndexSet;
2424use rustc_middle:: ty:: { TyCtxt , TyCtxtFeed } ;
2525use rustc_proc_macro:: bridge:: client:: ProcMacro ;
2626use rustc_session:: config:: {
27- self , CrateType , ExtendedTargetModifierInfo , ExternLocation , OptionsTargetModifiers ,
28- TargetModifier ,
27+ CrateType , ExtendedTargetModifierInfo , ExternLocation , OptionsTargetModifiers , TargetModifier ,
2928} ;
3029use rustc_session:: cstore:: { CrateDepKind , CrateSource , ExternCrate , ExternCrateSource } ;
3130use rustc_session:: lint:: { self , BuiltinLintDiag } ;
3231use rustc_session:: output:: validate_crate_name;
3332use rustc_session:: search_paths:: PathKind ;
3433use rustc_span:: edition:: Edition ;
3534use rustc_span:: { DUMMY_SP , Ident , Span , Symbol , sym} ;
36- use rustc_target:: spec:: { PanicStrategy , Target , TargetTuple } ;
35+ use rustc_target:: spec:: { PanicStrategy , Target } ;
3736use tracing:: { debug, info, trace} ;
3837
3938use crate :: errors;
@@ -697,7 +696,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
697696 let mut proc_macro_locator = locator. clone ( ) ;
698697
699698 // 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 ) ;
701700
702701 // Load the proc macro crate for the target
703702 let target_result =
@@ -709,17 +708,12 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
709708 None => return Ok ( None ) ,
710709 } ;
711710
712- // Load the proc macro crate for the host
713-
714711 // Use the existing crate_rejections as we want the error message to be affected by
715712 // loading the host proc macro.
716713 * 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) ;
723717
724718 locator. hash = host_hash;
725719
@@ -739,16 +733,8 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
739733 // affect the error message we emit
740734 let mut proc_macro_locator = locator. clone ( ) ;
741735
742- // Try to load a proc macro
743- proc_macro_locator. is_proc_macro = true ;
744-
745736 // 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) ;
752738
753739 let Some ( host_result) =
754740 self . load ( & mut proc_macro_locator, & mut CrateRejections :: default ( ) ) ?
0 commit comments