about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
diff options
context:
space:
mode:
authorMiguel Guarniz <mi9uel9@gmail.com>2022-07-15 23:13:04 -0400
committerMiguel Guarniz <mi9uel9@gmail.com>2022-07-29 18:25:58 -0400
commit25bdc8965e7a80cb3a72da79ca568953738fe433 (patch)
tree9e5c141b84918483db882f87c8d1bbb6b3702da1 /compiler/rustc_mir_transform
parent3924dac7bb29bc8eb348059c901e8f912399c857 (diff)
downloadrust-25bdc8965e7a80cb3a72da79ca568953738fe433.tar.gz
rust-25bdc8965e7a80cb3a72da79ca568953738fe433.zip
Change maybe_body_owned_by to take local def id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Diffstat (limited to 'compiler/rustc_mir_transform')
-rw-r--r--compiler/rustc_mir_transform/src/check_unsafety.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs
index a2ad96cfc16..13ae8a1cd3e 100644
--- a/compiler/rustc_mir_transform/src/check_unsafety.rs
+++ b/compiler/rustc_mir_transform/src/check_unsafety.rs
@@ -464,15 +464,15 @@ fn check_unused_unsafe(
     def_id: LocalDefId,
     used_unsafe_blocks: &FxHashMap<HirId, UsedUnsafeBlockData>,
 ) -> Vec<(HirId, UnusedUnsafe)> {
-    let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
-    let body_id = tcx.hir().maybe_body_owned_by(hir_id);
+    let body_id = tcx.hir().maybe_body_owned_by(def_id);
 
     let Some(body_id) = body_id else {
         debug!("check_unused_unsafe({:?}) - no body found", def_id);
         return vec![];
     };
-    let body = tcx.hir().body(body_id);
 
+    let body = tcx.hir().body(body_id);
+    let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
     let context = match tcx.hir().fn_sig_by_hir_id(hir_id) {
         Some(sig) if sig.header.unsafety == hir::Unsafety::Unsafe => Context::UnsafeFn(hir_id),
         _ => Context::Safe,