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 1
1
//! Analyze all modules in a project for diagnostics. Exits with a non-zero
2
2
//! status code if any errors are found.
3
3
4
+ use project_model:: { CargoConfig , RustcSource } ;
4
5
use rustc_hash:: FxHashSet ;
5
6
6
7
use hir:: { db:: HirDatabase , Crate , Module } ;
@@ -14,7 +15,8 @@ use crate::cli::{
14
15
15
16
impl flags:: Diagnostics {
16
17
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 ) ;
18
20
let load_cargo_config = LoadCargoConfig {
19
21
load_out_dirs_from_check : !self . disable_build_scripts ,
20
22
with_proc_macro_server : ProcMacroServerChoice :: Sysroot ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use ide_db::LineIndexDatabase;
13
13
use ide_db:: base_db:: salsa:: { self , ParallelDatabase } ;
14
14
use ide_db:: line_index:: WideEncoding ;
15
15
use lsp_types:: { self , lsif} ;
16
- use project_model:: { CargoConfig , ProjectManifest , ProjectWorkspace } ;
16
+ use project_model:: { CargoConfig , ProjectManifest , ProjectWorkspace , RustcSource } ;
17
17
use vfs:: { AbsPathBuf , Vfs } ;
18
18
19
19
use crate :: cli:: load_cargo:: ProcMacroServerChoice ;
@@ -289,7 +289,8 @@ impl flags::Lsif {
289
289
pub fn run ( self ) -> Result < ( ) > {
290
290
eprintln ! ( "Generating LSIF started..." ) ;
291
291
let now = Instant :: now ( ) ;
292
- let cargo_config = CargoConfig :: default ( ) ;
292
+ let mut cargo_config = CargoConfig :: default ( ) ;
293
+ cargo_config. sysroot = Some ( RustcSource :: Discover ) ;
293
294
let no_progress = & |_| ( ) ;
294
295
let load_cargo_config = LoadCargoConfig {
295
296
load_out_dirs_from_check : true ,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ use ide::{
15
15
TokenStaticData ,
16
16
} ;
17
17
use ide_db:: LineIndexDatabase ;
18
- use project_model:: { CargoConfig , ProjectManifest , ProjectWorkspace } ;
18
+ use project_model:: { CargoConfig , ProjectManifest , ProjectWorkspace , RustcSource } ;
19
19
use scip:: types as scip_types;
20
20
use std:: env;
21
21
@@ -29,7 +29,8 @@ impl flags::Scip {
29
29
pub fn run ( self ) -> Result < ( ) > {
30
30
eprintln ! ( "Generating SCIP start..." ) ;
31
31
let now = Instant :: now ( ) ;
32
- let cargo_config = CargoConfig :: default ( ) ;
32
+ let mut cargo_config = CargoConfig :: default ( ) ;
33
+ cargo_config. sysroot = Some ( RustcSource :: Discover ) ;
33
34
34
35
let no_progress = & |s| ( eprintln ! ( "rust-analyzer: Loading {s}" ) ) ;
35
36
let load_cargo_config = LoadCargoConfig {
Original file line number Diff line number Diff line change 1
1
//! Applies structured search replace rules from the command line.
2
2
3
3
use ide_ssr:: MatchFinder ;
4
- use project_model:: CargoConfig ;
4
+ use project_model:: { CargoConfig , RustcSource } ;
5
5
6
6
use crate :: cli:: {
7
7
flags,
@@ -12,7 +12,8 @@ use crate::cli::{
12
12
impl flags:: Ssr {
13
13
pub fn run ( self ) -> Result < ( ) > {
14
14
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 ) ;
16
17
let load_cargo_config = LoadCargoConfig {
17
18
load_out_dirs_from_check : true ,
18
19
with_proc_macro_server : ProcMacroServerChoice :: Sysroot ,
You can’t perform that action at this time.
0 commit comments