diff --git a/compiler/rustc/src/main.rs b/compiler/rustc/src/main.rs index 434b978ae3151..1cfc96ef9379d 100644 --- a/compiler/rustc/src/main.rs +++ b/compiler/rustc/src/main.rs @@ -1,4 +1,4 @@ -#![feature(unix_sigpipe)] +#![cfg_attr(bootstrap, feature(unix_sigpipe))] // A note about jemalloc: rustc uses jemalloc when built for CI and // distribution. The obvious way to do this is with the `#[global_allocator]` diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 409aef9185d92..fa667842388a7 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -200,6 +200,21 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { ); } } + // Check unstable flavors of the `#[unix_sigpipe]` attribute. + if attr.has_name(sym::unix_sigpipe) + && let Some(value) = attr.value_str() + && (value == sym::sig_ign || value == sym::inherit) + { + gate!( + self, + unix_sigpipe, + attr.span, + format!( + "the `#[unix_sigpipe = \"{}\"]` attribute is an experimental feature", + value.as_str() + ) + ); + } if !attr.is_doc_comment() && let [seg, _] = attr.get_normal_item().path.segments.as_slice() && seg.ident.name == sym::diagnostic diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 019cc1c847e91..0598ce6648467 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -364,7 +364,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ), // Entry point: - gated!(unix_sigpipe, Normal, template!(Word, NameValueStr: "inherit|sig_ign|sig_dfl"), ErrorFollowing, experimental!(unix_sigpipe)), + ungated!(unix_sigpipe, Normal, template!(Word, NameValueStr: "inherit|sig_ign|sig_dfl"), ErrorFollowing), ungated!(start, Normal, template!(Word), WarnFollowing), ungated!(no_start, CrateLevel, template!(Word), WarnFollowing), ungated!(no_main, CrateLevel, template!(Word), WarnFollowing), diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index 648ef9d51deaa..1d90ef0642244 100644 --- a/compiler/rustc_passes/messages.ftl +++ b/compiler/rustc_passes/messages.ftl @@ -692,7 +692,7 @@ passes_undefined_naked_function_abi = Rust ABI is unsupported in naked functions passes_unix_sigpipe_values = - valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` + the only valid variant of the `unix_sigpipe` attribute is `#[unix_sigpipe = "sig_dfl"]` passes_unknown_external_lang_item = unknown external lang item: `{$lang_item}` diff --git a/src/tools/rustdoc/main.rs b/src/tools/rustdoc/main.rs index b81f46d1211ce..ac58bc7423aff 100644 --- a/src/tools/rustdoc/main.rs +++ b/src/tools/rustdoc/main.rs @@ -1,4 +1,4 @@ -#![feature(unix_sigpipe)] +#![cfg_attr(bootstrap, feature(unix_sigpipe))] #[unix_sigpipe = "sig_dfl"] fn main() { diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.rs index 7bf1c7350c386..4883653cca9ce 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.rs @@ -1,4 +1,6 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature -#[unix_sigpipe] //~ error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` +#![cfg_attr(with_feature, feature(unix_sigpipe))] + +#[unix_sigpipe] //~ error: the only valid variant of the `unix_sigpipe` attribute is `#[unix_sigpipe = "sig_dfl"] fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.stderr deleted file mode 100644 index 56218ed499ece..0000000000000 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` - --> $DIR/unix_sigpipe-bare.rs:3:1 - | -LL | #[unix_sigpipe] - | ^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.with_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.with_feature.stderr new file mode 100644 index 0000000000000..7a8a232e9423e --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.with_feature.stderr @@ -0,0 +1,8 @@ +error: the only valid variant of the `unix_sigpipe` attribute is `#[unix_sigpipe = "sig_dfl"]` + --> $DIR/unix_sigpipe-bare.rs:5:1 + | +LL | #[unix_sigpipe] + | ^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.without_feature.stderr new file mode 100644 index 0000000000000..7a8a232e9423e --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.without_feature.stderr @@ -0,0 +1,8 @@ +error: the only valid variant of the `unix_sigpipe` attribute is `#[unix_sigpipe = "sig_dfl"]` + --> $DIR/unix_sigpipe-bare.rs:5:1 + | +LL | #[unix_sigpipe] + | ^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.rs index f5fa177f29c18..5f1f1a5d9d208 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.rs @@ -1,4 +1,6 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature + +#![cfg_attr(with_feature, feature(unix_sigpipe))] #![unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute cannot be used at crate level fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.with_feature.stderr similarity index 91% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.with_feature.stderr index fdfa30180863b..9c2336bcfee95 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.with_feature.stderr @@ -1,5 +1,5 @@ error: `unix_sigpipe` attribute cannot be used at crate level - --> $DIR/unix_sigpipe-crate.rs:2:1 + --> $DIR/unix_sigpipe-crate.rs:4:1 | LL | #![unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.without_feature.stderr new file mode 100644 index 0000000000000..9c2336bcfee95 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.without_feature.stderr @@ -0,0 +1,17 @@ +error: `unix_sigpipe` attribute cannot be used at crate level + --> $DIR/unix_sigpipe-crate.rs:4:1 + | +LL | #![unix_sigpipe = "sig_dfl"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn main() {} + | ---- the inner attribute doesn't annotate this function + | +help: perhaps you meant to use an outer attribute + | +LL - #![unix_sigpipe = "sig_dfl"] +LL + #[unix_sigpipe = "sig_dfl"] + | + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs index 26cf49a23d428..6c738b15e1e2a 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs @@ -1,5 +1,8 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature + +#![cfg_attr(with_feature, feature(unix_sigpipe))] #[unix_sigpipe = "sig_dfl"] -#[unix_sigpipe = "sig_ign"] //~ error: multiple `unix_sigpipe` attributes +#[unix_sigpipe = "sig_ign"] //[without_feature]~ the `#[unix_sigpipe = "sig_ign"]` attribute is an experimental feature +//~^ error: multiple `unix_sigpipe` attributes fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.with_feature.stderr similarity index 73% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.with_feature.stderr index 40f16d1caec04..fb1daf77edfa1 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.with_feature.stderr @@ -1,11 +1,11 @@ error: multiple `unix_sigpipe` attributes - --> $DIR/unix_sigpipe-different-duplicates.rs:4:1 + --> $DIR/unix_sigpipe-different-duplicates.rs:6:1 | LL | #[unix_sigpipe = "sig_ign"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unix_sigpipe-different-duplicates.rs:3:1 + --> $DIR/unix_sigpipe-different-duplicates.rs:5:1 | LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.without_feature.stderr new file mode 100644 index 0000000000000..25593f9abfd79 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.without_feature.stderr @@ -0,0 +1,25 @@ +error[E0658]: the `#[unix_sigpipe = "sig_ign"]` attribute is an experimental feature + --> $DIR/unix_sigpipe-different-duplicates.rs:6:1 + | +LL | #[unix_sigpipe = "sig_ign"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #97889 for more information + = help: add `#![feature(unix_sigpipe)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: multiple `unix_sigpipe` attributes + --> $DIR/unix_sigpipe-different-duplicates.rs:6:1 + | +LL | #[unix_sigpipe = "sig_ign"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unix_sigpipe-different-duplicates.rs:5:1 + | +LL | #[unix_sigpipe = "sig_dfl"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs index 7030977ba94da..0706d26c181b2 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs @@ -1,4 +1,6 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature + +#![cfg_attr(with_feature, feature(unix_sigpipe))] #[unix_sigpipe = "sig_dfl"] #[unix_sigpipe = "sig_dfl"] //~ error: multiple `unix_sigpipe` attributes diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.with_feature.stderr similarity index 77% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.with_feature.stderr index 7d1821600e9b2..44a0c43582d7a 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.with_feature.stderr @@ -1,11 +1,11 @@ error: multiple `unix_sigpipe` attributes - --> $DIR/unix_sigpipe-duplicates.rs:4:1 + --> $DIR/unix_sigpipe-duplicates.rs:6:1 | LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unix_sigpipe-duplicates.rs:3:1 + --> $DIR/unix_sigpipe-duplicates.rs:5:1 | LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.without_feature.stderr new file mode 100644 index 0000000000000..44a0c43582d7a --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.without_feature.stderr @@ -0,0 +1,14 @@ +error: multiple `unix_sigpipe` attributes + --> $DIR/unix_sigpipe-duplicates.rs:6:1 + | +LL | #[unix_sigpipe = "sig_dfl"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unix_sigpipe-duplicates.rs:5:1 + | +LL | #[unix_sigpipe = "sig_dfl"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.rs index 4f864807752c2..a8cd1c7c9e097 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.rs @@ -1,9 +1,11 @@ -// run-pass +// revisions: with_feature without_feature +// [with_feature]run-pass +// [without_feature]check-fail // aux-build:sigpipe-utils.rs -#![feature(unix_sigpipe)] +#![cfg_attr(with_feature, feature(unix_sigpipe))] -#[unix_sigpipe = "inherit"] +#[unix_sigpipe = "inherit"] //[without_feature]~ ERROR the `#[unix_sigpipe = "inherit"]` attribute is an experimental feature fn main() { extern crate sigpipe_utils; diff --git a/tests/ui/feature-gates/feature-gate-unix_sigpipe.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.without_feature.stderr similarity index 78% rename from tests/ui/feature-gates/feature-gate-unix_sigpipe.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.without_feature.stderr index 88c18e726835e..93d2fe7ff0f8b 100644 --- a/tests/ui/feature-gates/feature-gate-unix_sigpipe.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.without_feature.stderr @@ -1,5 +1,5 @@ -error[E0658]: the `#[unix_sigpipe]` attribute is an experimental feature - --> $DIR/feature-gate-unix_sigpipe.rs:3:1 +error[E0658]: the `#[unix_sigpipe = "inherit"]` attribute is an experimental feature + --> $DIR/unix_sigpipe-inherit.rs:8:1 | LL | #[unix_sigpipe = "inherit"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs index 462ae24a88425..bd38dee4cefbf 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs @@ -1,4 +1,6 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature + +#![cfg_attr(with_feature, feature(unix_sigpipe))] #[unix_sigpipe(sig_dfl)] //~ error: malformed `unix_sigpipe` attribute input fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.with_feature.stderr similarity index 90% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.with_feature.stderr index bfa174fc4bac1..d3ef869d5e0a5 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.with_feature.stderr @@ -1,5 +1,5 @@ error: malformed `unix_sigpipe` attribute input - --> $DIR/unix_sigpipe-list.rs:3:1 + --> $DIR/unix_sigpipe-list.rs:5:1 | LL | #[unix_sigpipe(sig_dfl)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.without_feature.stderr new file mode 100644 index 0000000000000..d3ef869d5e0a5 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.without_feature.stderr @@ -0,0 +1,15 @@ +error: malformed `unix_sigpipe` attribute input + --> $DIR/unix_sigpipe-list.rs:5:1 + | +LL | #[unix_sigpipe(sig_dfl)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: the following are the possible correct uses + | +LL | #[unix_sigpipe = "inherit|sig_ign|sig_dfl"] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | #[unix_sigpipe] + | ~~~~~~~~~~~~~~~ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.rs index 16731a4ba2c6e..f2b94e41b670f 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.rs @@ -1,4 +1,6 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature + +#![cfg_attr(with_feature, feature(unix_sigpipe))] #[unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` fn f() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.with_feature.stderr similarity index 80% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.with_feature.stderr index fcdd5db8f294b..f70e983530143 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.with_feature.stderr @@ -1,5 +1,5 @@ error: `unix_sigpipe` attribute can only be used on `fn main()` - --> $DIR/unix_sigpipe-non-main-fn.rs:3:1 + --> $DIR/unix_sigpipe-non-main-fn.rs:5:1 | LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.without_feature.stderr new file mode 100644 index 0000000000000..f70e983530143 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.without_feature.stderr @@ -0,0 +1,8 @@ +error: `unix_sigpipe` attribute can only be used on `fn main()` + --> $DIR/unix_sigpipe-non-main-fn.rs:5:1 + | +LL | #[unix_sigpipe = "sig_dfl"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.rs index a2435258620a0..9f7315fc10752 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.rs @@ -1,4 +1,6 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature + +#![cfg_attr(with_feature, feature(unix_sigpipe))] mod m { #[unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute can only be used on root `fn main()` diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.with_feature.stderr similarity index 80% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.with_feature.stderr index 98afb62fdb43b..6b06339ca97cd 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.with_feature.stderr @@ -1,5 +1,5 @@ error: `unix_sigpipe` attribute can only be used on root `fn main()` - --> $DIR/unix_sigpipe-non-root-main.rs:4:5 + --> $DIR/unix_sigpipe-non-root-main.rs:6:5 | LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.without_feature.stderr new file mode 100644 index 0000000000000..6b06339ca97cd --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.without_feature.stderr @@ -0,0 +1,8 @@ +error: `unix_sigpipe` attribute can only be used on root `fn main()` + --> $DIR/unix_sigpipe-non-root-main.rs:6:5 + | +LL | #[unix_sigpipe = "sig_dfl"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-rustc_main.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-rustc_main.rs index 6befb9e956594..bd8433158ce06 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-rustc_main.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-rustc_main.rs @@ -1,7 +1,8 @@ +// revisions: with_feature without_feature // run-pass // aux-build:sigpipe-utils.rs -#![feature(unix_sigpipe)] +#![cfg_attr(with_feature, feature(unix_sigpipe))] #![feature(rustc_attrs)] #[unix_sigpipe = "sig_dfl"] diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_dfl.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_dfl.rs index 238c0d57a68d2..0a3030bb3847b 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_dfl.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_dfl.rs @@ -1,7 +1,8 @@ +// revisions: with_feature without_feature // run-pass // aux-build:sigpipe-utils.rs -#![feature(unix_sigpipe)] +#![cfg_attr(with_feature, feature(unix_sigpipe))] #[unix_sigpipe = "sig_dfl"] fn main() { diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.rs index 0a42a5b5ef16b..ba58d706c1c3e 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.rs @@ -1,9 +1,11 @@ -// run-pass +// revisions: with_feature without_feature +// [with_feature]run-pass +// [without_feature]check-fail // aux-build:sigpipe-utils.rs -#![feature(unix_sigpipe)] +#![cfg_attr(with_feature, feature(unix_sigpipe))] -#[unix_sigpipe = "sig_ign"] +#[unix_sigpipe = "sig_ign"] //[without_feature]~ the `#[unix_sigpipe = "sig_ign"]` attribute is an experimental feature fn main() { extern crate sigpipe_utils; diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.without_feature.stderr new file mode 100644 index 0000000000000..0da124275547e --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.without_feature.stderr @@ -0,0 +1,13 @@ +error[E0658]: the `#[unix_sigpipe = "sig_ign"]` attribute is an experimental feature + --> $DIR/unix_sigpipe-sig_ign.rs:8:1 + | +LL | #[unix_sigpipe = "sig_ign"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #97889 for more information + = help: add `#![feature(unix_sigpipe)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs index 945b820f9e00a..9c358efa1ccfd 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs @@ -1,5 +1,7 @@ +// revisions: with_feature without_feature + #![feature(start)] -#![feature(unix_sigpipe)] +#![cfg_attr(with_feature, feature(unix_sigpipe))] #[start] #[unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.with_feature.stderr similarity index 82% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.with_feature.stderr index 3d56b3655c957..24e5f5576737b 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.with_feature.stderr @@ -1,5 +1,5 @@ error: `unix_sigpipe` attribute can only be used on `fn main()` - --> $DIR/unix_sigpipe-start.rs:5:1 + --> $DIR/unix_sigpipe-start.rs:7:1 | LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.without_feature.stderr similarity index 82% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.without_feature.stderr index a8fc51bdbc430..24e5f5576737b 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.without_feature.stderr @@ -1,5 +1,5 @@ error: `unix_sigpipe` attribute can only be used on `fn main()` - --> $DIR/unix_sigpipe-struct.rs:3:1 + --> $DIR/unix_sigpipe-start.rs:7:1 | LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs index 662779c082177..a5a7c8ad95e98 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs @@ -1,4 +1,6 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature + +#![cfg_attr(with_feature, feature(unix_sigpipe))] #[unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` struct S; diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.with_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.with_feature.stderr new file mode 100644 index 0000000000000..2b4fb03b55655 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.with_feature.stderr @@ -0,0 +1,8 @@ +error: `unix_sigpipe` attribute can only be used on `fn main()` + --> $DIR/unix_sigpipe-struct.rs:5:1 + | +LL | #[unix_sigpipe = "sig_dfl"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.without_feature.stderr new file mode 100644 index 0000000000000..2b4fb03b55655 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.without_feature.stderr @@ -0,0 +1,8 @@ +error: `unix_sigpipe` attribute can only be used on `fn main()` + --> $DIR/unix_sigpipe-struct.rs:5:1 + | +LL | #[unix_sigpipe = "sig_dfl"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.rs index 4ec25de00ec3b..5c92eab88b5ad 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.rs @@ -1,4 +1,6 @@ -#![feature(unix_sigpipe)] +// revisions: with_feature without_feature -#[unix_sigpipe = "wrong"] //~ error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` +#![cfg_attr(with_feature, feature(unix_sigpipe))] + +#[unix_sigpipe = "wrong"] //~ error: the only valid variant of the `unix_sigpipe` attribute is `#[unix_sigpipe = "sig_dfl"] fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.stderr deleted file mode 100644 index d750443e4a984..0000000000000 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` - --> $DIR/unix_sigpipe-wrong.rs:3:1 - | -LL | #[unix_sigpipe = "wrong"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.with_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.with_feature.stderr new file mode 100644 index 0000000000000..ad759ab5cd475 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.with_feature.stderr @@ -0,0 +1,8 @@ +error: the only valid variant of the `unix_sigpipe` attribute is `#[unix_sigpipe = "sig_dfl"]` + --> $DIR/unix_sigpipe-wrong.rs:5:1 + | +LL | #[unix_sigpipe = "wrong"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.without_feature.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.without_feature.stderr new file mode 100644 index 0000000000000..ad759ab5cd475 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.without_feature.stderr @@ -0,0 +1,8 @@ +error: the only valid variant of the `unix_sigpipe` attribute is `#[unix_sigpipe = "sig_dfl"]` + --> $DIR/unix_sigpipe-wrong.rs:5:1 + | +LL | #[unix_sigpipe = "wrong"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe.stderr deleted file mode 100644 index b18ec9abc3745..0000000000000 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` - --> $DIR/unix_sigpipe.rs:3:1 - | -LL | #[unix_sigpipe] - | ^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/feature-gates/feature-gate-unix_sigpipe-inherit.rs b/tests/ui/feature-gates/feature-gate-unix_sigpipe-inherit.rs new file mode 100644 index 0000000000000..849bccffd884a --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-unix_sigpipe-inherit.rs @@ -0,0 +1,6 @@ +// gate-test-unix_sigpipe + +#![crate_type = "bin"] + +#[unix_sigpipe = "inherit"] //~ the `#[unix_sigpipe = "inherit"]` attribute is an experimental feature +fn main () {} diff --git a/tests/ui/feature-gates/feature-gate-unix_sigpipe-inherit.stderr b/tests/ui/feature-gates/feature-gate-unix_sigpipe-inherit.stderr new file mode 100644 index 0000000000000..aab232db9d054 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-unix_sigpipe-inherit.stderr @@ -0,0 +1,13 @@ +error[E0658]: the `#[unix_sigpipe = "inherit"]` attribute is an experimental feature + --> $DIR/feature-gate-unix_sigpipe-inherit.rs:3:1 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #97889 for more information + = help: add `#![feature(unix_sigpipe)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-unix_sigpipe-sig_ign.rs b/tests/ui/feature-gates/feature-gate-unix_sigpipe-sig_ign.rs new file mode 100644 index 0000000000000..bde8f981da69f --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-unix_sigpipe-sig_ign.rs @@ -0,0 +1,6 @@ +// gate-test-unix_sigpipe + +#![crate_type = "bin"] + +#[unix_sigpipe = "sig_ign"] //~ the `#[unix_sigpipe = "sig_ign"]` attribute is an experimental feature +fn main () {} diff --git a/tests/ui/feature-gates/feature-gate-unix_sigpipe-sig_ign.stderr b/tests/ui/feature-gates/feature-gate-unix_sigpipe-sig_ign.stderr new file mode 100644 index 0000000000000..c110d38c4baa4 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-unix_sigpipe-sig_ign.stderr @@ -0,0 +1,13 @@ +error[E0658]: the `#[unix_sigpipe = "sig_ign"]` attribute is an experimental feature + --> $DIR/feature-gate-unix_sigpipe-sig_ign.rs:3:1 + | +LL | #[unix_sigpipe = "sig_ign"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #97889 for more information + = help: add `#![feature(unix_sigpipe)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-unix_sigpipe.rs b/tests/ui/feature-gates/feature-gate-unix_sigpipe.rs deleted file mode 100644 index 46dc3f6cc17a5..0000000000000 --- a/tests/ui/feature-gates/feature-gate-unix_sigpipe.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "bin"] - -#[unix_sigpipe = "inherit"] //~ the `#[unix_sigpipe]` attribute is an experimental feature -fn main () {}