Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/diagnostics.rs')
-rw-r--r--crates/hir/src/diagnostics.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index fc77d1889c..64e982c42d 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -271,11 +271,17 @@ pub struct PrivateField {
pub field: Field,
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum UnsafeLint {
+ HardError,
+ UnsafeOpInUnsafeFn,
+ DeprecatedSafe2024,
+}
+
#[derive(Debug)]
pub struct MissingUnsafe {
pub node: InFile<AstPtr<Either<ast::Expr, ast::Pat>>>,
- /// If true, the diagnostics is an `unsafe_op_in_unsafe_fn` lint instead of a hard error.
- pub only_lint: bool,
+ pub lint: UnsafeLint,
pub reason: UnsafetyReason,
}
@@ -411,7 +417,7 @@ impl AnyDiagnostic {
pub(crate) fn body_validation_diagnostic(
db: &dyn HirDatabase,
diagnostic: BodyValidationDiagnostic,
- source_map: &hir_def::body::BodySourceMap,
+ source_map: &hir_def::expr_store::BodySourceMap,
) -> Option<AnyDiagnostic> {
match diagnostic {
BodyValidationDiagnostic::RecordMissingFields { record, variant, missed_fields } => {
@@ -547,7 +553,7 @@ impl AnyDiagnostic {
def: DefWithBodyId,
d: &InferenceDiagnostic,
outer_types_source_map: &TypesSourceMap,
- source_map: &hir_def::body::BodySourceMap,
+ source_map: &hir_def::expr_store::BodySourceMap,
) -> Option<AnyDiagnostic> {
let expr_syntax = |expr| {
source_map.expr_syntax(expr).inspect_err(|_| stdx::never!("synthetic syntax")).ok()