Skip to content

Commit

Permalink
Fetch diagnostic item later.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Aug 4, 2023
1 parent 0edd4f9 commit 905b63d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 905b63d

Please sign in to comment.