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 2e14238f950f2..8e7619befe0ab 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -206,6 +206,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() + ) + ); + } // Emit errors for non-staged-api crates. if !self.features.staged_api { diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 0d51e1e46e06a..f6757f108d46a 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -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)), + ungated!(unix_sigpipe, Normal, template!(Word, NameValueStr: "inherit|sig_ign|sig_dfl"), ErrorFollowing), 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), diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index c223b8475288b..f3a3a684dcbc9 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..f4052b6354358 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 d6d020c52b28d..baf4a21794626 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)] -#![unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute cannot be used at crate level +//@ 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 68% 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 1666f4a3ee81c..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,7 +1,7 @@ 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 = "inherit"] +LL | #![unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | fn main() {} @@ -9,8 +9,8 @@ LL | fn main() {} | help: perhaps you meant to use an outer attribute | -LL - #![unix_sigpipe = "inherit"] -LL + #[unix_sigpipe = "inherit"] +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-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 294cb38526bd0..ff4b440115945 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 -#[unix_sigpipe = "sig_ign"] -#[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes +#![cfg_attr(with_feature, feature(unix_sigpipe))] + +#[unix_sigpipe = "sig_dfl"] +#[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 65% 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 c2a3b9f45f9ac..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,13 +1,13 @@ error: multiple `unix_sigpipe` attributes - --> $DIR/unix_sigpipe-different-duplicates.rs:4:1 + --> $DIR/unix_sigpipe-different-duplicates.rs:6:1 | -LL | #[unix_sigpipe = "inherit"] +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_ign"] +LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error 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 eccb23021b6b8..30741ff321fc1 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs @@ -1,5 +1,7 @@ -#![feature(unix_sigpipe)] +//@ revisions: with_feature without_feature -#[unix_sigpipe = "inherit"] -#[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes +#![cfg_attr(with_feature, feature(unix_sigpipe))] + +#[unix_sigpipe = "sig_dfl"] +#[unix_sigpipe = "sig_dfl"] //~ error: multiple `unix_sigpipe` attributes fn main() {} 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 60% 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 c86e54a1e532f..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,13 +1,13 @@ error: multiple `unix_sigpipe` attributes - --> $DIR/unix_sigpipe-duplicates.rs:4:1 + --> $DIR/unix_sigpipe-duplicates.rs:6:1 | -LL | #[unix_sigpipe = "inherit"] +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 = "inherit"] +LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error 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 db3407a7d55fc..a1c08bb93a299 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 b5ebc07a04338..88cd222178fdb 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 -#[unix_sigpipe(inherit)] //~ error: malformed `unix_sigpipe` attribute input +#![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 83% 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 b1d79d7c2a2eb..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,7 +1,7 @@ error: malformed `unix_sigpipe` attribute input - --> $DIR/unix_sigpipe-list.rs:3:1 + --> $DIR/unix_sigpipe-list.rs:5:1 | -LL | #[unix_sigpipe(inherit)] +LL | #[unix_sigpipe(sig_dfl)] | ^^^^^^^^^^^^^^^^^^^^^^^^ | help: the following are the possible correct uses 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 cde6719fc9ce4..f41d818efce14 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,6 +1,8 @@ -#![feature(unix_sigpipe)] +//@ revisions: with_feature without_feature -#[unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` +#![cfg_attr(with_feature, feature(unix_sigpipe))] + +#[unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` fn f() {} fn main() {} 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 65% 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 124141b655218..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,7 +1,7 @@ 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 = "inherit"] +LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error 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 16f7276398e20..59f1e2ec57c86 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,7 +1,9 @@ -#![feature(unix_sigpipe)] +//@ revisions: with_feature without_feature + +#![cfg_attr(with_feature, feature(unix_sigpipe))] mod m { - #[unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute can only be used on root `fn main()` + #[unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute can only be used on root `fn main()` 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 65% 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 346d83fa66458..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,7 +1,7 @@ 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 = "inherit"] +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.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 02a3f48f3b395..f96346e833d77 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 30f2a9b143062..b0014292d7697 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 ccd6c67866018..77a6dba4f9ab0 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 64fd5ec4f0ed8..f6a389726937a 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs @@ -1,6 +1,8 @@ +//@ revisions: with_feature without_feature + #![feature(start)] -#![feature(unix_sigpipe)] +#![cfg_attr(with_feature, feature(unix_sigpipe))] #[start] -#[unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` +#[unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` fn custom_start(argc: isize, argv: *const *const u8) -> isize { 0 } 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 67% 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 9f691e396bdaf..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,7 +1,7 @@ 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 = "inherit"] +LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error 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 66% 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 d5eec9424c82c..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,7 +1,7 @@ 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 = "inherit"] +LL | #[unix_sigpipe = "sig_dfl"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs index a5e47cfebc89e..43136283487c3 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs @@ -1,6 +1,8 @@ -#![feature(unix_sigpipe)] +//@ revisions: with_feature without_feature -#[unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` +#![cfg_attr(with_feature, feature(unix_sigpipe))] + +#[unix_sigpipe = "sig_dfl"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` struct S; fn main() {} 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..b32bf4a0f562e 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/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..9fee9fc2b655f --- /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:5: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..d053fb5b0cb29 --- /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:5: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 () {}