about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-08-03 13:12:58 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-08-04 16:09:14 +0000
commit905b63d64f8f91016a7fb0e40f0c0ae4f5e8cc51 (patch)
tree37f0e2b6572a806bdeac6351016043fd8f2c2ddf
parent0edd4f9499523d9f6c48607fe8dc70c84c5a404a (diff)
downloadrust-905b63d64f8f91016a7fb0e40f0c0ae4f5e8cc51.tar.gz
rust-905b63d64f8f91016a7fb0e40f0c0ae4f5e8cc51.zip
Fetch diagnostic item later.
-rw-r--r--compiler/rustc_lint/src/builtin.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 310e542e5a5..9bdb8ae6a5f 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -756,14 +756,14 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
             _ => return,
         }
 
-        let Some(debug) = cx.tcx.get_diagnostic_item(sym::Debug) else { return };
-
         // Avoid listing trait impls if the trait is allowed.
         let (level, _) = cx.tcx.lint_level_at_node(MISSING_DEBUG_IMPLEMENTATIONS, item.hir_id());
         if level == Level::Allow {
             return;
         }
 
+        let Some(debug) = cx.tcx.get_diagnostic_item(sym::Debug) else { return };
+
         let has_impl = cx
             .tcx
             .non_blanket_impls_for_ty(debug, cx.tcx.type_of(item.owner_id).instantiate_identity())