Auto merge of #17981 - lnicola:proc-macro-cwd, r=Veykril

minor: Fix cwd used for proc macro expansion

Fixes #17980.
This commit is contained in:
bors 2024-08-28 10:36:11 +00:00
commit 248a55723b
2 changed files with 2 additions and 2 deletions

View File

@ -65,7 +65,7 @@ pub(crate) fn inject_rustc_tool_env(
// NOTE: Technically we should set this for all crates, but that will worsen the deduplication // NOTE: Technically we should set this for all crates, but that will worsen the deduplication
// logic so for now just keeping it proc-macros ought to be fine. // logic so for now just keeping it proc-macros ought to be fine.
if kind.is_proc_macro() { if kind.is_proc_macro() {
env.set("CARGO_RUSTC_CURRENT_DIR", cargo.manifest_path().to_string()); env.set("CARGO_RUSTC_CURRENT_DIR", cargo.manifest_path().parent().to_string());
} }
} }

View File

@ -278,7 +278,7 @@ fn crate_graph_dedup() {
assert_eq!(regex_crate_graph.iter().count(), 60); assert_eq!(regex_crate_graph.iter().count(), 60);
crate_graph.extend(regex_crate_graph, &mut regex_proc_macros, |(_, a), (_, b)| a == b); crate_graph.extend(regex_crate_graph, &mut regex_proc_macros, |(_, a), (_, b)| a == b);
assert_eq!(crate_graph.iter().count(), 119); assert_eq!(crate_graph.iter().count(), 118);
} }
#[test] #[test]