mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
hir is cancelation free
This commit is contained in:
parent
8ba9c2d4ce
commit
02c3d2f78e
3 changed files with 6 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
use ra_db::{CrateId, Cancelable, FileId};
|
use ra_db::{CrateId, FileId};
|
||||||
use ra_syntax::{ast, TreeArc, SyntaxNode};
|
use ra_syntax::{ast, TreeArc, SyntaxNode};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -142,10 +142,7 @@ impl Module {
|
||||||
self.resolve_path_impl(db, path)
|
self.resolve_path_impl(db, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn problems(
|
pub fn problems(&self, db: &impl HirDatabase) -> Vec<(TreeArc<SyntaxNode>, Problem)> {
|
||||||
&self,
|
|
||||||
db: &impl HirDatabase,
|
|
||||||
) -> Cancelable<Vec<(TreeArc<SyntaxNode>, Problem)>> {
|
|
||||||
self.problems_impl(db)
|
self.problems_impl(db)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use ra_db::{Cancelable, SourceRootId, FileId};
|
use ra_db::{SourceRootId, FileId};
|
||||||
use ra_syntax::{ast, SyntaxNode, AstNode, TreeArc};
|
use ra_syntax::{ast, SyntaxNode, AstNode, TreeArc};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -176,12 +176,9 @@ impl Module {
|
||||||
curr_per_ns
|
curr_per_ns
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn problems_impl(
|
pub fn problems_impl(&self, db: &impl HirDatabase) -> Vec<(TreeArc<SyntaxNode>, Problem)> {
|
||||||
&self,
|
|
||||||
db: &impl HirDatabase,
|
|
||||||
) -> Cancelable<Vec<(TreeArc<SyntaxNode>, Problem)>> {
|
|
||||||
let loc = self.def_id.loc(db);
|
let loc = self.def_id.loc(db);
|
||||||
let module_tree = db.module_tree(loc.source_root_id);
|
let module_tree = db.module_tree(loc.source_root_id);
|
||||||
Ok(loc.module_id.problems(&module_tree, db))
|
loc.module_id.problems(&module_tree, db)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ impl db::RootDatabase {
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
if let Some(m) = source_binder::module_from_file_id(self, file_id) {
|
if let Some(m) = source_binder::module_from_file_id(self, file_id) {
|
||||||
for (name_node, problem) in m.problems(self)? {
|
for (name_node, problem) in m.problems(self) {
|
||||||
let source_root = self.file_source_root(file_id);
|
let source_root = self.file_source_root(file_id);
|
||||||
let diag = match problem {
|
let diag = match problem {
|
||||||
Problem::UnresolvedModule { candidate } => {
|
Problem::UnresolvedModule { candidate } => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue