mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 14:03:35 +00:00
Auto merge of #14239 - Veykril:sysroot-cli, r=Veykril
fix: Load the sysroot in all CLI commands
This commit is contained in:
commit
a8d3c46082
4 changed files with 12 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
//! Analyze all modules in a project for diagnostics. Exits with a non-zero
|
||||
//! status code if any errors are found.
|
||||
|
||||
use project_model::{CargoConfig, RustcSource};
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
use hir::{db::HirDatabase, Crate, Module};
|
||||
|
@ -14,7 +15,8 @@ use crate::cli::{
|
|||
|
||||
impl flags::Diagnostics {
|
||||
pub fn run(self) -> anyhow::Result<()> {
|
||||
let cargo_config = Default::default();
|
||||
let mut cargo_config = CargoConfig::default();
|
||||
cargo_config.sysroot = Some(RustcSource::Discover);
|
||||
let load_cargo_config = LoadCargoConfig {
|
||||
load_out_dirs_from_check: !self.disable_build_scripts,
|
||||
with_proc_macro_server: ProcMacroServerChoice::Sysroot,
|
||||
|
|
|
@ -13,7 +13,7 @@ use ide_db::LineIndexDatabase;
|
|||
use ide_db::base_db::salsa::{self, ParallelDatabase};
|
||||
use ide_db::line_index::WideEncoding;
|
||||
use lsp_types::{self, lsif};
|
||||
use project_model::{CargoConfig, ProjectManifest, ProjectWorkspace};
|
||||
use project_model::{CargoConfig, ProjectManifest, ProjectWorkspace, RustcSource};
|
||||
use vfs::{AbsPathBuf, Vfs};
|
||||
|
||||
use crate::cli::load_cargo::ProcMacroServerChoice;
|
||||
|
@ -289,7 +289,8 @@ impl flags::Lsif {
|
|||
pub fn run(self) -> Result<()> {
|
||||
eprintln!("Generating LSIF started...");
|
||||
let now = Instant::now();
|
||||
let cargo_config = CargoConfig::default();
|
||||
let mut cargo_config = CargoConfig::default();
|
||||
cargo_config.sysroot = Some(RustcSource::Discover);
|
||||
let no_progress = &|_| ();
|
||||
let load_cargo_config = LoadCargoConfig {
|
||||
load_out_dirs_from_check: true,
|
||||
|
|
|
@ -15,7 +15,7 @@ use ide::{
|
|||
TokenStaticData,
|
||||
};
|
||||
use ide_db::LineIndexDatabase;
|
||||
use project_model::{CargoConfig, ProjectManifest, ProjectWorkspace};
|
||||
use project_model::{CargoConfig, ProjectManifest, ProjectWorkspace, RustcSource};
|
||||
use scip::types as scip_types;
|
||||
use std::env;
|
||||
|
||||
|
@ -29,7 +29,8 @@ impl flags::Scip {
|
|||
pub fn run(self) -> Result<()> {
|
||||
eprintln!("Generating SCIP start...");
|
||||
let now = Instant::now();
|
||||
let cargo_config = CargoConfig::default();
|
||||
let mut cargo_config = CargoConfig::default();
|
||||
cargo_config.sysroot = Some(RustcSource::Discover);
|
||||
|
||||
let no_progress = &|s| (eprintln!("rust-analyzer: Loading {s}"));
|
||||
let load_cargo_config = LoadCargoConfig {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Applies structured search replace rules from the command line.
|
||||
|
||||
use ide_ssr::MatchFinder;
|
||||
use project_model::CargoConfig;
|
||||
use project_model::{CargoConfig, RustcSource};
|
||||
|
||||
use crate::cli::{
|
||||
flags,
|
||||
|
@ -12,7 +12,8 @@ use crate::cli::{
|
|||
impl flags::Ssr {
|
||||
pub fn run(self) -> Result<()> {
|
||||
use ide_db::base_db::SourceDatabaseExt;
|
||||
let cargo_config = CargoConfig::default();
|
||||
let mut cargo_config = CargoConfig::default();
|
||||
cargo_config.sysroot = Some(RustcSource::Discover);
|
||||
let load_cargo_config = LoadCargoConfig {
|
||||
load_out_dirs_from_check: true,
|
||||
with_proc_macro_server: ProcMacroServerChoice::Sysroot,
|
||||
|
|
Loading…
Reference in a new issue