File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed
crates/rust-analyzer/src/cli Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 11//! Analyze all modules in a project for diagnostics. Exits with a non-zero
22//! status code if any errors are found.
33
4+ use project_model:: { CargoConfig , RustcSource } ;
45use rustc_hash:: FxHashSet ;
56
67use hir:: { db:: HirDatabase , Crate , Module } ;
@@ -14,7 +15,8 @@ use crate::cli::{
1415
1516impl flags:: Diagnostics {
1617 pub fn run ( self ) -> anyhow:: Result < ( ) > {
17- let cargo_config = Default :: default ( ) ;
18+ let mut cargo_config = CargoConfig :: default ( ) ;
19+ cargo_config. sysroot = Some ( RustcSource :: Discover ) ;
1820 let load_cargo_config = LoadCargoConfig {
1921 load_out_dirs_from_check : !self . disable_build_scripts ,
2022 with_proc_macro_server : ProcMacroServerChoice :: Sysroot ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use ide_db::LineIndexDatabase;
1313use ide_db:: base_db:: salsa:: { self , ParallelDatabase } ;
1414use ide_db:: line_index:: WideEncoding ;
1515use lsp_types:: { self , lsif} ;
16- use project_model:: { CargoConfig , ProjectManifest , ProjectWorkspace } ;
16+ use project_model:: { CargoConfig , ProjectManifest , ProjectWorkspace , RustcSource } ;
1717use vfs:: { AbsPathBuf , Vfs } ;
1818
1919use crate :: cli:: load_cargo:: ProcMacroServerChoice ;
@@ -289,7 +289,8 @@ impl flags::Lsif {
289289 pub fn run ( self ) -> Result < ( ) > {
290290 eprintln ! ( "Generating LSIF started..." ) ;
291291 let now = Instant :: now ( ) ;
292- let cargo_config = CargoConfig :: default ( ) ;
292+ let mut cargo_config = CargoConfig :: default ( ) ;
293+ cargo_config. sysroot = Some ( RustcSource :: Discover ) ;
293294 let no_progress = & |_| ( ) ;
294295 let load_cargo_config = LoadCargoConfig {
295296 load_out_dirs_from_check : true ,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ use ide::{
1515 TokenStaticData ,
1616} ;
1717use ide_db:: LineIndexDatabase ;
18- use project_model:: { CargoConfig , ProjectManifest , ProjectWorkspace } ;
18+ use project_model:: { CargoConfig , ProjectManifest , ProjectWorkspace , RustcSource } ;
1919use scip:: types as scip_types;
2020use std:: env;
2121
@@ -29,7 +29,8 @@ impl flags::Scip {
2929 pub fn run ( self ) -> Result < ( ) > {
3030 eprintln ! ( "Generating SCIP start..." ) ;
3131 let now = Instant :: now ( ) ;
32- let cargo_config = CargoConfig :: default ( ) ;
32+ let mut cargo_config = CargoConfig :: default ( ) ;
33+ cargo_config. sysroot = Some ( RustcSource :: Discover ) ;
3334
3435 let no_progress = & |s| ( eprintln ! ( "rust-analyzer: Loading {s}" ) ) ;
3536 let load_cargo_config = LoadCargoConfig {
Original file line number Diff line number Diff line change 11//! Applies structured search replace rules from the command line.
22
33use ide_ssr:: MatchFinder ;
4- use project_model:: CargoConfig ;
4+ use project_model:: { CargoConfig , RustcSource } ;
55
66use crate :: cli:: {
77 flags,
@@ -12,7 +12,8 @@ use crate::cli::{
1212impl flags:: Ssr {
1313 pub fn run ( self ) -> Result < ( ) > {
1414 use ide_db:: base_db:: SourceDatabaseExt ;
15- let cargo_config = CargoConfig :: default ( ) ;
15+ let mut cargo_config = CargoConfig :: default ( ) ;
16+ cargo_config. sysroot = Some ( RustcSource :: Discover ) ;
1617 let load_cargo_config = LoadCargoConfig {
1718 load_out_dirs_from_check : true ,
1819 with_proc_macro_server : ProcMacroServerChoice :: Sysroot ,
You can’t perform that action at this time.
0 commit comments