aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/diagnostics.rs')
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs
index 5b0dda634..d9c2b1214 100644
--- a/crates/ra_hir_ty/src/diagnostics.rs
+++ b/crates/ra_hir_ty/src/diagnostics.rs
@@ -1,14 +1,30 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2pub mod expr;
3mod match_check;
4pub mod unsafe_check;
2 5
3use std::any::Any; 6use std::any::Any;
4 7
5use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile}; 8use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile};
9use ra_prof::profile;
6use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr}; 10use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr};
7use stdx::format_to; 11use stdx::format_to;
8 12
9pub use hir_def::{diagnostics::UnresolvedModule, expr::MatchArm, path::Path}; 13pub use hir_def::{diagnostics::UnresolvedModule, expr::MatchArm, path::Path, DefWithBodyId};
10pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink}; 14pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink};
11 15
16use crate::db::HirDatabase;
17
18pub fn validate_body(db: &dyn HirDatabase, owner: DefWithBodyId, sink: &mut DiagnosticSink<'_>) {
19 let _p = profile("validate_body");
20 let infer = db.infer(owner);
21 infer.add_diagnostics(db, owner, sink);
22 let mut validator = expr::ExprValidator::new(owner, infer.clone(), sink);
23 validator.validate_body(db);
24 let mut validator = unsafe_check::UnsafeValidator::new(owner, infer, sink);
25 validator.validate_body(db);
26}
27
12#[derive(Debug)] 28#[derive(Debug)]
13pub struct NoSuchField { 29pub struct NoSuchField {
14 pub file: HirFileId, 30 pub file: HirFileId,