diff options
author | Edwin Cheng <[email protected]> | 2021-03-14 10:31:14 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2021-03-14 10:31:14 +0000 |
commit | 8cc0c7f420d7d59a4fd162d893eaad54aa4b7f22 (patch) | |
tree | a9b4c6b7ed37299c192b68657ac52db851f8e50a | |
parent | ab3f584299d44a0187c2977a0e0ebf8727bc9e40 (diff) |
Add no-sysroot flag for analysis-stats
-rw-r--r-- | crates/rust-analyzer/src/bin/flags.rs | 3 | ||||
-rw-r--r-- | crates/rust-analyzer/src/bin/main.rs | 1 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/analysis_stats.rs | 5 |
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 | }; |
20 | use itertools::Itertools; | 20 | use itertools::Itertools; |
21 | use oorandom::Rand32; | 21 | use oorandom::Rand32; |
22 | use project_model::CargoConfig; | ||
22 | use rayon::prelude::*; | 23 | use rayon::prelude::*; |
23 | use rustc_hash::FxHashSet; | 24 | use rustc_hash::FxHashSet; |
24 | use stdx::format_to; | 25 | use 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, |