summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2024-12-13 12:19:46 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2024-12-14 20:31:07 +0000
commit8a4e5d7444c4d43097c2ca0d1b8e64be9dbeddfa (patch)
treef9ca6a3756cf0bb0e520702d99f2064231e95223 /compiler/rustc_hir_analysis/src
parent3a64bef2ba54542d3440634602e088c2597d9ed2 (diff)
downloadrust-8a4e5d7444c4d43097c2ca0d1b8e64be9dbeddfa.tar.gz
rust-8a4e5d7444c4d43097c2ca0d1b8e64be9dbeddfa.zip
Add some convenience helper methods on `hir::Safety`
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index 022a6d457ec..8ff94fa566d 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -6,7 +6,7 @@ use rustc_data_structures::unord::{UnordMap, UnordSet};
 use rustc_errors::MultiSpan;
 use rustc_errors::codes::*;
 use rustc_hir::def::{CtorKind, DefKind};
-use rustc_hir::{Node, Safety, intravisit};
+use rustc_hir::{Node, intravisit};
 use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
 use rustc_infer::traits::{Obligation, ObligationCauseCode};
 use rustc_lint_defs::builtin::{
@@ -161,7 +161,7 @@ fn check_unsafe_fields(tcx: TyCtxt<'_>, item_def_id: LocalDefId) {
     };
     let typing_env = ty::TypingEnv::non_body_analysis(tcx, item_def_id);
     for field in def.all_fields() {
-        if field.safety != Safety::Unsafe {
+        if !field.safety.is_unsafe() {
             continue;
         }
         let Ok(field_ty) = tcx.try_normalize_erasing_regions(typing_env, field.ty(tcx, args))