diff options
Diffstat (limited to 'crates/ra_hir_ty/src/diagnostics.rs')
-rw-r--r-- | crates/ra_hir_ty/src/diagnostics.rs | 18 |
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 |
2 | pub mod expr; | ||
3 | mod match_check; | ||
4 | pub mod unsafe_check; | ||
2 | 5 | ||
3 | use std::any::Any; | 6 | use std::any::Any; |
4 | 7 | ||
5 | use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile}; | 8 | use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile}; |
9 | use ra_prof::profile; | ||
6 | use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr}; | 10 | use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr}; |
7 | use stdx::format_to; | 11 | use stdx::format_to; |
8 | 12 | ||
9 | pub use hir_def::{diagnostics::UnresolvedModule, expr::MatchArm, path::Path}; | 13 | pub use hir_def::{diagnostics::UnresolvedModule, expr::MatchArm, path::Path, DefWithBodyId}; |
10 | pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink}; | 14 | pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink}; |
11 | 15 | ||
16 | use crate::db::HirDatabase; | ||
17 | |||
18 | pub 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)] |
13 | pub struct NoSuchField { | 29 | pub struct NoSuchField { |
14 | pub file: HirFileId, | 30 | pub file: HirFileId, |