We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
diagnostic::on_unimplemented
1 parent 0d7b2fb commit 4847f22Copy full SHA for 4847f22
compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs
@@ -499,12 +499,14 @@ impl<'tcx> OnUnimplementedDirective {
499
}
500
501
if is_diagnostic_namespace_variant {
502
- tcx.emit_node_span_lint(
503
- UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
504
- tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
505
- vec![item.span()],
506
- MalformedOnUnimplementedAttrLint::new(item.span()),
507
- );
+ 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()),
508
+ );
509
+ }
510
} else {
511
// nothing found
512
tcx.dcx().emit_err(NoValueInOnUnimplemented { span: item.span() });
0 commit comments