Skip to content

Commit 8f3c0f1

Browse files
committed
Auto merge of rust-lang#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.
2 parents 46fe025 + 490df54 commit 8f3c0f1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ impl flags::AnalysisStats {
8181
with_proc_macro_server: if self.disable_proc_macros {
8282
ProcMacroServerChoice::None
8383
} else {
84-
ProcMacroServerChoice::Sysroot
84+
match self.proc_macro_srv {
85+
Some(ref path) => {
86+
let path = vfs::AbsPathBuf::assert_utf8(path.to_owned());
87+
ProcMacroServerChoice::Explicit(path)
88+
}
89+
None => ProcMacroServerChoice::Sysroot,
90+
}
8591
},
8692
prefill_caches: false,
8793
};

src/tools/rust-analyzer/crates/rust-analyzer/src/cli/flags.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ xflags::xflags! {
7676
optional --disable-build-scripts
7777
/// Don't use expand proc macros.
7878
optional --disable-proc-macros
79+
/// Run the proc-macro-srv binary at the specified path.
80+
optional --proc-macro-srv path: PathBuf
7981
/// Skip body lowering.
8082
optional --skip-lowering
8183
/// Skip type inference.
@@ -120,7 +122,7 @@ xflags::xflags! {
120122
optional --disable-build-scripts
121123
/// Don't use expand proc macros.
122124
optional --disable-proc-macros
123-
/// Run a custom proc-macro-srv binary.
125+
/// Run the proc-macro-srv binary at the specified path.
124126
optional --proc-macro-srv path: PathBuf
125127
}
126128

@@ -133,7 +135,7 @@ xflags::xflags! {
133135
optional --disable-build-scripts
134136
/// Don't use expand proc macros.
135137
optional --disable-proc-macros
136-
/// Run a custom proc-macro-srv binary.
138+
/// Run the proc-macro-srv binary at the specified path.
137139
optional --proc-macro-srv path: PathBuf
138140
}
139141

@@ -233,6 +235,7 @@ pub struct AnalysisStats {
233235
pub no_sysroot: bool,
234236
pub disable_build_scripts: bool,
235237
pub disable_proc_macros: bool,
238+
pub proc_macro_srv: Option<PathBuf>,
236239
pub skip_lowering: bool,
237240
pub skip_inference: bool,
238241
pub skip_mir_stats: bool,

0 commit comments

Comments
 (0)