diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 310e542e5a5e..9bdb8ae6a5f9 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())