about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-26 06:25:34 +0000
committerbors <bors@rust-lang.org>2023-05-26 06:25:34 +0000
commit615aaa47510fae3a95d95cbd8b607c3695878161 (patch)
tree06cb9969c10131c37270e59184803051e8b01283
parent06d02e0a1e15a329501e3da8b278be4ca4a381b2 (diff)
parent5b0e170683cb8eccfbbb1270c21a1aacedf0ecee (diff)
downloadrust-615aaa47510fae3a95d95cbd8b607c3695878161.tar.gz
rust-615aaa47510fae3a95d95cbd8b607c3695878161.zip
Auto merge of #14894 - Wilfred:index_scip_path, r=lnicola
Allow users to override the .scip output file path

Previously, rust-analyzer would write to the file index.scip unconditionally.
-rw-r--r--crates/rust-analyzer/src/cli/flags.rs4
-rw-r--r--crates/rust-analyzer/src/cli/scip.rs4
2 files changed, 7 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/cli/flags.rs b/crates/rust-analyzer/src/cli/flags.rs
index 6b5a79b431f..31012c01b95 100644
--- a/crates/rust-analyzer/src/cli/flags.rs
+++ b/crates/rust-analyzer/src/cli/flags.rs
@@ -112,6 +112,9 @@ xflags::xflags! {
 
         cmd scip {
             required path: PathBuf
+
+            /// The output path where the SCIP file will be written to. Defaults to `index.scip`.
+            optional --output path: PathBuf
         }
     }
 }
@@ -208,6 +211,7 @@ pub struct Lsif {
 #[derive(Debug)]
 pub struct Scip {
     pub path: PathBuf,
+    pub output: Option<PathBuf>,
 }
 
 impl RustAnalyzer {
diff --git a/crates/rust-analyzer/src/cli/scip.rs b/crates/rust-analyzer/src/cli/scip.rs
index 61924d58431..b0b724bdfe7 100644
--- a/crates/rust-analyzer/src/cli/scip.rs
+++ b/crates/rust-analyzer/src/cli/scip.rs
@@ -2,6 +2,7 @@
 
 use std::{
     collections::{HashMap, HashSet},
+    path::PathBuf,
     time::Instant,
 };
 
@@ -165,7 +166,8 @@ impl flags::Scip {
             special_fields: Default::default(),
         };
 
-        scip::write_message_to_file("index.scip", index)
+        let out_path = self.output.unwrap_or_else(|| PathBuf::from(r"index.scip"));
+        scip::write_message_to_file(out_path, index)
             .map_err(|err| anyhow::anyhow!("Failed to write scip to file: {}", err))?;
 
         eprintln!("Generating SCIP finished {:?}", now.elapsed());