Auto merge of #18208 - davidbarsky:davidbarsky/push-qkwkmttnukqt, r=lnicola
internal: allow overriding proc macro server in analysis-stats
Needed this argument in order to profile the proc macro expansion server (c.f., [this Zulip conversation](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/.60macro_rules!.60-based.20macros.20for.20derives.2Fattributes/near/473466794)). I also took the opportunity to change the phrasing for `--proc-macro-srv`.
Ran with `samply record ~/.cargo/bin/rust-analyzer analysis-stats --proc-macro-srv /Users/dbarsky/.cargo/bin/rust-analyzer-proc-macro-srv --parallel .` on rust-analyzer itself.
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index e899e0e..2851101 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -81,7 +81,13 @@
with_proc_macro_server: if self.disable_proc_macros {
ProcMacroServerChoice::None
} else {
- ProcMacroServerChoice::Sysroot
+ match self.proc_macro_srv {
+ Some(ref path) => {
+ let path = vfs::AbsPathBuf::assert_utf8(path.to_owned());
+ ProcMacroServerChoice::Explicit(path)
+ }
+ None => ProcMacroServerChoice::Sysroot,
+ }
},
prefill_caches: false,
};
diff --git a/crates/rust-analyzer/src/cli/flags.rs b/crates/rust-analyzer/src/cli/flags.rs
index 73e7165..60d621b 100644
--- a/crates/rust-analyzer/src/cli/flags.rs
+++ b/crates/rust-analyzer/src/cli/flags.rs
@@ -76,6 +76,8 @@
optional --disable-build-scripts
/// Don't use expand proc macros.
optional --disable-proc-macros
+ /// Run the proc-macro-srv binary at the specified path.
+ optional --proc-macro-srv path: PathBuf
/// Skip body lowering.
optional --skip-lowering
/// Skip type inference.
@@ -120,7 +122,7 @@
optional --disable-build-scripts
/// Don't use expand proc macros.
optional --disable-proc-macros
- /// Run a custom proc-macro-srv binary.
+ /// Run the proc-macro-srv binary at the specified path.
optional --proc-macro-srv path: PathBuf
}
@@ -133,7 +135,7 @@
optional --disable-build-scripts
/// Don't use expand proc macros.
optional --disable-proc-macros
- /// Run a custom proc-macro-srv binary.
+ /// Run the proc-macro-srv binary at the specified path.
optional --proc-macro-srv path: PathBuf
}
@@ -233,6 +235,7 @@
pub no_sysroot: bool,
pub disable_build_scripts: bool,
pub disable_proc_macros: bool,
+ pub proc_macro_srv: Option<PathBuf>,
pub skip_lowering: bool,
pub skip_inference: bool,
pub skip_mir_stats: bool,