Skip to content

Commit 366bd72

Browse files
committed
Auto merge of #12515 - Veykril:rustc-proc-macros, r=Veykril
fix: Pass the build data to rustc_private crates With this all proc-macros should resolve in rustc now when setting up the build script running command properly.
2 parents 6c65edf + 10e9f47 commit 366bd72

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

crates/project-model/src/workspace.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ fn cargo_to_crate_graph(
667667
&public_deps,
668668
cargo,
669669
&pkg_crates,
670+
build_scripts,
670671
);
671672
}
672673
}
@@ -728,6 +729,7 @@ fn handle_rustc_crates(
728729
public_deps: &SysrootPublicDeps,
729730
cargo: &CargoWorkspace,
730731
pkg_crates: &FxHashMap<la_arena::Idx<crate::PackageData>, Vec<(CrateId, TargetKind)>>,
732+
build_scripts: &WorkspaceBuildScripts,
731733
) {
732734
let mut rustc_pkg_crates = FxHashMap::default();
733735
// The root package of the rustc-dev component is rustc_driver, so we match that
@@ -781,7 +783,7 @@ fn handle_rustc_crates(
781783
let crate_id = add_target_crate_root(
782784
crate_graph,
783785
&rustc_workspace[pkg],
784-
None,
786+
build_scripts.get_output(pkg),
785787
cfg_options,
786788
&mut |path| load_proc_macro(&rustc_workspace[tgt].name, path),
787789
file_id,

crates/rust-analyzer/src/reload.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ pub(crate) fn load_proc_macro(
550550
}
551551
};
552552

553-
return client
553+
let proc_macros: Vec<_> = client
554554
.map(|it| it.load_dylib(dylib))
555555
.into_iter()
556556
.flat_map(|it| match it {
@@ -568,6 +568,12 @@ pub(crate) fn load_proc_macro(
568568
})
569569
.map(|expander| expander_to_proc_macro(expander, dummy_replace))
570570
.collect();
571+
tracing::info!(
572+
"Loaded proc-macros for {}: {:?}",
573+
path.display(),
574+
proc_macros.iter().map(|it| it.name.clone()).collect::<Vec<_>>()
575+
);
576+
return proc_macros;
571577

572578
fn expander_to_proc_macro(
573579
expander: proc_macro_api::ProcMacro,

0 commit comments

Comments
 (0)