Rollup merge of #122293 - Enselic:no-bare-unix_sigpipe, r=fmease
diagnostics: Do not suggest using `#[unix_sigpipe]` without a value Remove `Word` from the `unix_sigpipe` attribute template so that plain `#[unix_sigpipe]` is not included in suggestions of valid forms of the attribute. Also re-arrange diagnostics code slightly to avoid duplicate diagnostics. Tracking issue is https://github.com/rust-lang/rust/issues/97889.
This commit is contained in:
commit
c4b159c4a0
5 changed files with 9 additions and 16 deletions
|
@ -389,7 +389,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
),
|
||||
|
||||
// Entry point:
|
||||
gated!(unix_sigpipe, Normal, template!(Word, NameValueStr: "inherit|sig_ign|sig_dfl"), ErrorFollowing, experimental!(unix_sigpipe)),
|
||||
gated!(unix_sigpipe, Normal, template!(NameValueStr: "inherit|sig_ign|sig_dfl"), ErrorFollowing, experimental!(unix_sigpipe)),
|
||||
ungated!(start, Normal, template!(Word), WarnFollowing, @only_local: true),
|
||||
ungated!(no_start, CrateLevel, template!(Word), WarnFollowing, @only_local: true),
|
||||
ungated!(no_main, CrateLevel, template!(Word), WarnFollowing, @only_local: true),
|
||||
|
|
|
@ -156,13 +156,13 @@ fn sigpipe(tcx: TyCtxt<'_>, def_id: DefId) -> u8 {
|
|||
(Some(sym::inherit), None) => sigpipe::INHERIT,
|
||||
(Some(sym::sig_ign), None) => sigpipe::SIG_IGN,
|
||||
(Some(sym::sig_dfl), None) => sigpipe::SIG_DFL,
|
||||
(_, Some(_)) => {
|
||||
// Keep going so that `fn emit_malformed_attribute()` can print
|
||||
// an excellent error message
|
||||
(Some(_), None) => {
|
||||
tcx.dcx().emit_err(UnixSigpipeValues { span: attr.span });
|
||||
sigpipe::DEFAULT
|
||||
}
|
||||
_ => {
|
||||
tcx.dcx().emit_err(UnixSigpipeValues { span: attr.span });
|
||||
// Keep going so that `fn emit_malformed_attribute()` can print
|
||||
// an excellent error message
|
||||
sigpipe::DEFAULT
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue