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/load-cargo/src/lib.rs b/crates/load-cargo/src/lib.rs
index baa4517..2ffefa1 100644
--- a/crates/load-cargo/src/lib.rs
+++ b/crates/load-cargo/src/lib.rs
@@ -265,6 +265,11 @@
                 entries.push(manifest.to_owned());
             }
 
+            for buildfile in ws.buildfiles() {
+                file_set_roots.push(VfsPath::from(buildfile.to_owned()));
+                entries.push(buildfile.to_owned());
+            }
+
             // In case of detached files we do **not** look for a rust-analyzer.toml.
             if !matches!(ws.kind, ProjectWorkspaceKind::DetachedFile { .. }) {
                 let ws_root = ws.workspace_root();
diff --git a/crates/project-model/src/workspace.rs b/crates/project-model/src/workspace.rs
index 17b40a8..c05c033 100644
--- a/crates/project-model/src/workspace.rs
+++ b/crates/project-model/src/workspace.rs
@@ -539,6 +539,17 @@
         }
     }
 
+    pub fn buildfiles(&self) -> Vec<AbsPathBuf> {
+        match &self.kind {
+            ProjectWorkspaceKind::Json(project) => project
+                .crates()
+                .filter_map(|(_, krate)| krate.build.as_ref().map(|build| build.build_file.clone()))
+                .map(AbsPathBuf::assert)
+                .collect(),
+            _ => vec![],
+        }
+    }
+
     pub fn find_sysroot_proc_macro_srv(&self) -> anyhow::Result<AbsPathBuf> {
         self.sysroot.discover_proc_macro_srv()
     }