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.
This commit is contained in:
bors
2023-05-26 06:25:34 +00:00
2 changed files with 7 additions and 1 deletions
+4
View File
@@ -112,6 +112,9 @@
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 {
+3 -1
View File
@@ -2,6 +2,7 @@
use std::{
collections::{HashMap, HashSet},
path::PathBuf,
time::Instant,
};
@@ -165,7 +166,8 @@ pub fn run(self) -> Result<()> {
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());