Skip to content

Commit

Permalink
(revert c2258d8) Use cargo env instead of crate_workspace_data for pr…
Browse files Browse the repository at this point in the history
…ocmacro expansion
  • Loading branch information
infiniteregrets committed Feb 12, 2025
1 parent c661e5e commit 45799a1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/hir-expand/src/proc_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,16 @@ impl CustomProcMacroExpander {
let krate_graph = db.crate_graph();
// Proc macros have access to the environment variables of the invoking crate.
let env = &krate_graph[calling_crate].env;
let current_dir =
env.get("CARGO_RUSTC_CURRENT_DIR").or_else(|| env.get("CARGO_MANIFEST_DIR"));
match proc_macro.expander.expand(
tt,
attr_arg,
env,
def_site,
call_site,
mixed_site,
db.crate_workspace_data()[&calling_crate]
.proc_macro_cwd
.as_ref()
.map(ToString::to_string),
current_dir
) {
Ok(t) => ExpandResult::ok(t),
Err(err) => match err {
Expand Down

0 comments on commit 45799a1

Please sign in to comment.