mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Revert "Handle dev-dependency cycles"
This commit is contained in:
parent
a96bb452a7
commit
10d7d7304b
13 changed files with 52 additions and 1798 deletions
|
@ -417,11 +417,6 @@ impl CrateGraph {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn duplicate(&mut self, id: CrateId) -> CrateId {
|
||||
let data = self[id].clone();
|
||||
self.arena.alloc(data)
|
||||
}
|
||||
|
||||
pub fn add_dep(
|
||||
&mut self,
|
||||
from: CrateId,
|
||||
|
@ -617,12 +612,6 @@ impl ops::Index<CrateId> for CrateGraph {
|
|||
}
|
||||
}
|
||||
|
||||
impl ops::IndexMut<CrateId> for CrateGraph {
|
||||
fn index_mut(&mut self, crate_id: CrateId) -> &mut CrateData {
|
||||
&mut self.arena[crate_id]
|
||||
}
|
||||
}
|
||||
|
||||
impl CrateData {
|
||||
fn add_dep(&mut self, dep: Dependency) {
|
||||
self.dependencies.push(dep)
|
||||
|
|
|
@ -6,10 +6,9 @@ mod input;
|
|||
mod change;
|
||||
pub mod fixture;
|
||||
|
||||
use std::{hash::BuildHasherDefault, panic, sync::Arc};
|
||||
use std::{panic, sync::Arc};
|
||||
|
||||
use indexmap::IndexSet;
|
||||
use rustc_hash::FxHasher;
|
||||
use rustc_hash::FxHashSet;
|
||||
use syntax::{ast, Parse, SourceFile, TextRange, TextSize};
|
||||
|
||||
pub use crate::{
|
||||
|
@ -60,10 +59,7 @@ pub trait FileLoader {
|
|||
/// Text of the file.
|
||||
fn file_text(&self, file_id: FileId) -> Arc<str>;
|
||||
fn resolve_path(&self, path: AnchoredPath<'_>) -> Option<FileId>;
|
||||
fn relevant_crates(
|
||||
&self,
|
||||
file_id: FileId,
|
||||
) -> Arc<IndexSet<CrateId, BuildHasherDefault<FxHasher>>>;
|
||||
fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>>;
|
||||
}
|
||||
|
||||
/// Database which stores all significant input facts: source code and project
|
||||
|
@ -103,16 +99,10 @@ pub trait SourceDatabaseExt: SourceDatabase {
|
|||
#[salsa::input]
|
||||
fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>;
|
||||
|
||||
fn source_root_crates(
|
||||
&self,
|
||||
id: SourceRootId,
|
||||
) -> Arc<IndexSet<CrateId, BuildHasherDefault<FxHasher>>>;
|
||||
fn source_root_crates(&self, id: SourceRootId) -> Arc<FxHashSet<CrateId>>;
|
||||
}
|
||||
|
||||
fn source_root_crates(
|
||||
db: &dyn SourceDatabaseExt,
|
||||
id: SourceRootId,
|
||||
) -> Arc<IndexSet<CrateId, BuildHasherDefault<FxHasher>>> {
|
||||
fn source_root_crates(db: &dyn SourceDatabaseExt, id: SourceRootId) -> Arc<FxHashSet<CrateId>> {
|
||||
let graph = db.crate_graph();
|
||||
let res = graph
|
||||
.iter()
|
||||
|
@ -138,10 +128,7 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
|
|||
source_root.resolve_path(path)
|
||||
}
|
||||
|
||||
fn relevant_crates(
|
||||
&self,
|
||||
file_id: FileId,
|
||||
) -> Arc<IndexSet<CrateId, BuildHasherDefault<FxHasher>>> {
|
||||
fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> {
|
||||
let _p = profile::span("relevant_crates");
|
||||
let source_root = self.0.file_source_root(file_id);
|
||||
self.0.source_root_crates(source_root)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue