Skip to content

Commit a4ea4be

Browse files
committed
rustc_macros: Allow marking diagnostic structs with #[must_use]
1 parent 5c25ff5 commit a4ea4be

File tree

1 file changed

+6
-0
lines changed
  • compiler/rustc_macros/src/diagnostics

1 file changed

+6
-0
lines changed

compiler/rustc_macros/src/diagnostics/utils.rs

+6
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,12 @@ impl SubdiagnosticVariant {
619619
let name = attr.path().segments.last().unwrap().ident.to_string();
620620
let name = name.as_str();
621621

622+
// We want diagnostic structs to be marked `#[must_use]`, so we must
623+
// allow it as a no-op attr here.
624+
if name == "must_use" {
625+
return Ok(None);
626+
}
627+
622628
let mut kind = match name {
623629
"label" => SubdiagnosticKind::Label,
624630
"note" => SubdiagnosticKind::Note,

0 commit comments

Comments
 (0)