Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/diagnostics/unsafe_check.rs')
| -rw-r--r-- | crates/hir-ty/src/diagnostics/unsafe_check.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/hir-ty/src/diagnostics/unsafe_check.rs b/crates/hir-ty/src/diagnostics/unsafe_check.rs index ee33f7d158..c37a194d47 100644 --- a/crates/hir-ty/src/diagnostics/unsafe_check.rs +++ b/crates/hir-ty/src/diagnostics/unsafe_check.rs @@ -253,12 +253,13 @@ impl<'db> UnsafeVisitor<'db> { | Pat::TupleStruct { .. } | Pat::Ref { .. } | Pat::Box { .. } + | Pat::Deref { .. } | Pat::Expr(..) | Pat::ConstBlock(..) => { self.on_unsafe_op(current.into(), UnsafetyReason::UnionField) } // `Or` only wraps other patterns, and `Missing`/`Wild` do not constitute a read. - Pat::Missing | Pat::Wild | Pat::Or(_) => {} + Pat::Missing | Pat::Rest | Pat::Wild | Pat::Or(_) => {} } } @@ -297,7 +298,7 @@ impl<'db> UnsafeVisitor<'db> { self.check_call(current, func); } if let TyKind::FnPtr(_, hdr) = callee.kind() - && hdr.safety == Safety::Unsafe + && hdr.safety() == Safety::Unsafe { self.on_unsafe_op(current.into(), UnsafetyReason::UnsafeFnCall); } @@ -424,7 +425,6 @@ impl<'db> UnsafeVisitor<'db> { Expr::Closure { args, .. } => { self.walk_pats_top(args.iter().copied(), current); } - Expr::Const(e) => self.walk_expr(*e), _ => {} } |