mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-19 19:44:31 +00:00
Use correct working directory for non-workspace proc-macro execution
This commit is contained in:
parent
d10388096e
commit
3a31741627
15 changed files with 159 additions and 31 deletions
|
|
@ -238,6 +238,9 @@ 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 =
|
||||
krate_graph[calling_crate].proc_macro_cwd.as_deref().map(ToString::to_string);
|
||||
|
||||
match proc_macro.expander.expand(
|
||||
tt,
|
||||
attr_arg,
|
||||
|
|
@ -245,10 +248,7 @@ impl CustomProcMacroExpander {
|
|||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue