Skip to content

Commit 45799a1

Browse files
(revert c2258d8) Use cargo env instead of crate_workspace_data for procmacro expansion
1 parent c661e5e commit 45799a1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

crates/hir-expand/src/proc_macro.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,16 @@ impl CustomProcMacroExpander {
238238
let krate_graph = db.crate_graph();
239239
// Proc macros have access to the environment variables of the invoking crate.
240240
let env = &krate_graph[calling_crate].env;
241+
let current_dir =
242+
env.get("CARGO_RUSTC_CURRENT_DIR").or_else(|| env.get("CARGO_MANIFEST_DIR"));
241243
match proc_macro.expander.expand(
242244
tt,
243245
attr_arg,
244246
env,
245247
def_site,
246248
call_site,
247249
mixed_site,
248-
db.crate_workspace_data()[&calling_crate]
249-
.proc_macro_cwd
250-
.as_ref()
251-
.map(ToString::to_string),
250+
current_dir
252251
) {
253252
Ok(t) => ExpandResult::ok(t),
254253
Err(err) => match err {

0 commit comments

Comments
 (0)