Skip to content

Commit

Permalink
Do not ICE on foreign malformed diagnostic::on_unimplemented
Browse files Browse the repository at this point in the history
Fix rust-lang#124651.

(cherry picked from commit 4847f22)
  • Loading branch information
estebank authored and cuviper committed May 16, 2024
1 parent a269819 commit 6af338d
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,14 @@ impl<'tcx> OnUnimplementedDirective {
}

if is_diagnostic_namespace_variant {
tcx.emit_node_span_lint(
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
vec![item.span()],
MalformedOnUnimplementedAttrLint::new(item.span()),
);
if let Some(def_id) = item_def_id.as_local() {
tcx.emit_node_span_lint(
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
tcx.local_def_id_to_hir_id(def_id),
vec![item.span()],
MalformedOnUnimplementedAttrLint::new(item.span()),
);
}
} else {
// nothing found
tcx.dcx().emit_err(NoValueInOnUnimplemented { span: item.span() });
Expand Down

0 comments on commit 6af338d

Please sign in to comment.