Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4be319b

Browse files
committedFeb 9, 2024·
Stabilize #[unix_sigpipe = "sig_dfl"] on fn main()
The attribute is used like this: #[unix_sigpipe = "sig_dfl"] fn main() { // ... } When used, `SIGPIPE` will be set to `SIG_DFL` before `fn main()` is invoked, rather than being set to `SIG_IGN` which is the default. This commit does NOT stabilize `#[unix_sigpipe = "sig_ign"]` or `#[unix_sigpipe = "inherit"]`. See the PR for more info.
1 parent 23358c3 commit 4be319b

File tree

49 files changed

+265
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+265
-65
lines changed
 

‎compiler/rustc/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(unix_sigpipe)]
1+
#![cfg_attr(bootstrap, feature(unix_sigpipe))]
22

33
// A note about jemalloc: rustc uses jemalloc when built for CI and
44
// distribution. The obvious way to do this is with the `#[global_allocator]`

‎compiler/rustc_ast_passes/src/feature_gate.rs

+15
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,21 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
200200
);
201201
}
202202
}
203+
// Check unstable flavors of the `#[unix_sigpipe]` attribute.
204+
if attr.has_name(sym::unix_sigpipe)
205+
&& let Some(value) = attr.value_str()
206+
&& (value == sym::sig_ign || value == sym::inherit)
207+
{
208+
gate!(
209+
self,
210+
unix_sigpipe,
211+
attr.span,
212+
format!(
213+
"the `#[unix_sigpipe = \"{}\"]` attribute is an experimental feature",
214+
value.as_str()
215+
)
216+
);
217+
}
203218
if !attr.is_doc_comment()
204219
&& let [seg, _] = attr.get_normal_item().path.segments.as_slice()
205220
&& seg.ident.name == sym::diagnostic

0 commit comments

Comments
 (0)
Please sign in to comment.