mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
internal: move missing unsafe diagnostic to hir
This commit is contained in:
parent
f8009666be
commit
0413d51317
6 changed files with 145 additions and 166 deletions
|
@ -36,14 +36,14 @@ use std::{iter, sync::Arc};
|
|||
use arrayvec::ArrayVec;
|
||||
use base_db::{CrateDisplayName, CrateId, Edition, FileId};
|
||||
use diagnostics::{
|
||||
BreakOutsideOfLoop, InactiveCode, MacroError, NoSuchField, UnimplementedBuiltinMacro,
|
||||
UnresolvedExternCrate, UnresolvedImport, UnresolvedMacroCall, UnresolvedModule,
|
||||
UnresolvedProcMacro,
|
||||
BreakOutsideOfLoop, InactiveCode, MacroError, MissingUnsafe, NoSuchField,
|
||||
UnimplementedBuiltinMacro, UnresolvedExternCrate, UnresolvedImport, UnresolvedMacroCall,
|
||||
UnresolvedModule, UnresolvedProcMacro,
|
||||
};
|
||||
use either::Either;
|
||||
use hir_def::{
|
||||
adt::{ReprKind, VariantData},
|
||||
body::BodyDiagnostic,
|
||||
body::{BodyDiagnostic, SyntheticSyntax},
|
||||
expr::{BindingAnnotation, LabelId, Pat, PatId},
|
||||
item_tree::ItemTreeNode,
|
||||
lang_item::LangItemTarget,
|
||||
|
@ -1060,6 +1060,18 @@ impl Function {
|
|||
}
|
||||
}
|
||||
|
||||
for expr in hir_ty::diagnostics::missing_unsafe(db, self.id.into()) {
|
||||
match source_map.as_ref().expr_syntax(expr) {
|
||||
Ok(in_file) => {
|
||||
sink.push(MissingUnsafe { file: in_file.file_id, expr: in_file.value })
|
||||
}
|
||||
Err(SyntheticSyntax) => {
|
||||
// FIXME: The `expr` was desugared, report or assert that
|
||||
// this dosen't happen.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hir_ty::diagnostics::validate_module_item(db, krate, self.id.into(), sink);
|
||||
hir_ty::diagnostics::validate_body(db, self.id.into(), sink);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue