aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-14 10:50:59 +0000
committerGitHub <[email protected]>2021-03-14 10:50:59 +0000
commita8a7fa834726eb763fe872b02db821f99098a498 (patch)
tree460dc2884d6f644762aee55bc191a4707b977f82
parent48adf6b697a0103307e3f5fca7aa60a80bf73776 (diff)
parent8cc0c7f420d7d59a4fd162d893eaad54aa4b7f22 (diff)
Merge #8011
8011: Add no-sysroot flag for analysis-stats r=edwin0cheng a=edwin0cheng Add `no-sysroot` flag for `rust-analyzer analysis-stats`. It is very useful for debugging propose. bors r+ Co-authored-by: Edwin Cheng <[email protected]>
-rw-r--r--crates/rust-analyzer/src/bin/flags.rs3
-rw-r--r--crates/rust-analyzer/src/bin/main.rs1
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs5
3 files changed, 8 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/bin/flags.rs b/crates/rust-analyzer/src/bin/flags.rs
index 3a7caaf3f..d8987633d 100644
--- a/crates/rust-analyzer/src/bin/flags.rs
+++ b/crates/rust-analyzer/src/bin/flags.rs
@@ -65,6 +65,8 @@ xflags::xflags! {
65 optional -o, --only path: String 65 optional -o, --only path: String
66 /// Also analyze all dependencies. 66 /// Also analyze all dependencies.
67 optional --with-deps 67 optional --with-deps
68 /// Don't load sysroot crates (`std`, `core` & friends).
69 optional --no-sysroot
68 70
69 /// Load OUT_DIR values by running `cargo check` before analysis. 71 /// Load OUT_DIR values by running `cargo check` before analysis.
70 optional --load-output-dirs 72 optional --load-output-dirs
@@ -176,6 +178,7 @@ pub struct AnalysisStats {
176 pub memory_usage: bool, 178 pub memory_usage: bool,
177 pub only: Option<String>, 179 pub only: Option<String>,
178 pub with_deps: bool, 180 pub with_deps: bool,
181 pub no_sysroot: bool,
179 pub load_output_dirs: bool, 182 pub load_output_dirs: bool,
180 pub with_proc_macro: bool, 183 pub with_proc_macro: bool,
181} 184}
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index 288847980..a0b611bff 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -74,6 +74,7 @@ fn try_main() -> Result<()> {
74 memory_usage: cmd.memory_usage, 74 memory_usage: cmd.memory_usage,
75 only: cmd.only, 75 only: cmd.only,
76 with_deps: cmd.with_deps, 76 with_deps: cmd.with_deps,
77 no_sysroot: cmd.no_sysroot,
77 path: cmd.path, 78 path: cmd.path,
78 load_output_dirs: cmd.load_output_dirs, 79 load_output_dirs: cmd.load_output_dirs,
79 with_proc_macro: cmd.with_proc_macro, 80 with_proc_macro: cmd.with_proc_macro,
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index c81c1d26e..9c59e7ee4 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -19,6 +19,7 @@ use ide_db::base_db::{
19}; 19};
20use itertools::Itertools; 20use itertools::Itertools;
21use oorandom::Rand32; 21use oorandom::Rand32;
22use project_model::CargoConfig;
22use rayon::prelude::*; 23use rayon::prelude::*;
23use rustc_hash::FxHashSet; 24use rustc_hash::FxHashSet;
24use stdx::format_to; 25use stdx::format_to;
@@ -46,6 +47,7 @@ pub struct AnalysisStatsCmd {
46 pub memory_usage: bool, 47 pub memory_usage: bool,
47 pub only: Option<String>, 48 pub only: Option<String>,
48 pub with_deps: bool, 49 pub with_deps: bool,
50 pub no_sysroot: bool,
49 pub path: PathBuf, 51 pub path: PathBuf,
50 pub load_output_dirs: bool, 52 pub load_output_dirs: bool,
51 pub with_proc_macro: bool, 53 pub with_proc_macro: bool,
@@ -59,7 +61,8 @@ impl AnalysisStatsCmd {
59 }; 61 };
60 62
61 let mut db_load_sw = self.stop_watch(); 63 let mut db_load_sw = self.stop_watch();
62 let cargo_config = Default::default(); 64 let mut cargo_config = CargoConfig::default();
65 cargo_config.no_sysroot = self.no_sysroot;
63 let load_cargo_config = LoadCargoConfig { 66 let load_cargo_config = LoadCargoConfig {
64 load_out_dirs_from_check: self.load_output_dirs, 67 load_out_dirs_from_check: self.load_output_dirs,
65 with_proc_macro: self.with_proc_macro, 68 with_proc_macro: self.with_proc_macro,