Skip to content

Commit 905b63d

Browse files
committed
Fetch diagnostic item later.
1 parent 0edd4f9 commit 905b63d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: compiler/rustc_lint/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -756,14 +756,14 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
756756
_ => return,
757757
}
758758

759-
let Some(debug) = cx.tcx.get_diagnostic_item(sym::Debug) else { return };
760-
761759
// Avoid listing trait impls if the trait is allowed.
762760
let (level, _) = cx.tcx.lint_level_at_node(MISSING_DEBUG_IMPLEMENTATIONS, item.hir_id());
763761
if level == Level::Allow {
764762
return;
765763
}
766764

765+
let Some(debug) = cx.tcx.get_diagnostic_item(sym::Debug) else { return };
766+
767767
let has_impl = cx
768768
.tcx
769769
.non_blanket_impls_for_ty(debug, cx.tcx.type_of(item.owner_id).instantiate_identity())

0 commit comments

Comments
 (0)