Properly set the working directory for proc-macro execution

This commit is contained in:
Lukas Wirth 2024-09-11 12:23:12 +02:00
parent db04f514f2
commit c2258d8880
5 changed files with 29 additions and 5 deletions

View file

@ -152,10 +152,9 @@ impl ProcMacro {
def_site: Span,
call_site: Span,
mixed_site: Span,
current_dir: Option<String>,
) -> Result<Result<tt::Subtree<Span>, PanicMessage>, ServerError> {
let version = self.process.version();
let current_dir =
env.get("CARGO_RUSTC_CURRENT_DIR").or_else(|| env.get("CARGO_MANIFEST_DIR"));
let mut span_data_table = SpanDataIndexMap::default();
let def_site = span_data_table.insert_full(def_site).0;