fix: Fix rustc proc-macro handling being broken on the rustc workspace itself
This commit is contained in:
parent
aaf08bdcc5
commit
88f0fe784f
@ -428,8 +428,9 @@ impl WorkspaceBuildScripts {
|
|||||||
for p in rustc.packages() {
|
for p in rustc.packages() {
|
||||||
let package = &rustc[p];
|
let package = &rustc[p];
|
||||||
if package.targets.iter().any(|&it| rustc[it].is_proc_macro) {
|
if package.targets.iter().any(|&it| rustc[it].is_proc_macro) {
|
||||||
if let Some((_, path)) =
|
if let Some((_, path)) = proc_macro_dylibs
|
||||||
proc_macro_dylibs.iter().find(|(name, _)| *name == package.name)
|
.iter()
|
||||||
|
.find(|(name, _)| *name.trim_start_matches("lib") == package.name)
|
||||||
{
|
{
|
||||||
bs.outputs[p].proc_macro_dylib_path = Some(path.clone());
|
bs.outputs[p].proc_macro_dylib_path = Some(path.clone());
|
||||||
}
|
}
|
||||||
|
@ -932,7 +932,7 @@ fn cargo_to_crate_graph(
|
|||||||
if has_private {
|
if has_private {
|
||||||
// If the user provided a path to rustc sources, we add all the rustc_private crates
|
// If the user provided a path to rustc sources, we add all the rustc_private crates
|
||||||
// and create dependencies on them for the crates which opt-in to that
|
// and create dependencies on them for the crates which opt-in to that
|
||||||
if let Some((rustc_workspace, build_scripts)) = rustc {
|
if let Some((rustc_workspace, rustc_build_scripts)) = rustc {
|
||||||
handle_rustc_crates(
|
handle_rustc_crates(
|
||||||
&mut crate_graph,
|
&mut crate_graph,
|
||||||
&mut pkg_to_lib_crate,
|
&mut pkg_to_lib_crate,
|
||||||
@ -945,7 +945,13 @@ fn cargo_to_crate_graph(
|
|||||||
&pkg_crates,
|
&pkg_crates,
|
||||||
&cfg_options,
|
&cfg_options,
|
||||||
override_cfg,
|
override_cfg,
|
||||||
build_scripts,
|
if rustc_workspace.workspace_root() == cargo.workspace_root() {
|
||||||
|
// the rustc workspace does not use the installed toolchain's proc-macro server
|
||||||
|
// so we need to make sure we don't use the pre compiled proc-macros there either
|
||||||
|
build_scripts
|
||||||
|
} else {
|
||||||
|
rustc_build_scripts
|
||||||
|
},
|
||||||
target_layout,
|
target_layout,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user