summaryrefslogtreecommitdiffstats
path: root/tests/ui/feature-gates
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/feature-gates')
-rw-r--r--tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs33
-rw-r--r--tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr57
-rw-r--r--tests/ui/feature-gates/feature-gate-cfg-relocation-model.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-cfg-relocation-model.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr9
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.rs24
-rw-r--r--tests/ui/feature-gates/feature-gate-thiscall.rs38
-rw-r--r--tests/ui/feature-gates/feature-gate-thiscall.stderr115
-rw-r--r--tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr7
-rw-r--r--tests/ui/feature-gates/print-with-path.cfg.stderr2
-rw-r--r--tests/ui/feature-gates/print-with-path.rs7
-rw-r--r--tests/ui/feature-gates/print-with-path.target-cpus.stderr2
-rw-r--r--tests/ui/feature-gates/print-with-path.target-features.stderr2
14 files changed, 142 insertions, 174 deletions
diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs
new file mode 100644
index 000000000..7755a46da
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs
@@ -0,0 +1,33 @@
+// needs-llvm-components: riscv
+// compile-flags: --target=riscv32imc-unknown-none-elf --crate-type=rlib
+#![no_core]
+#![feature(no_core, lang_items)]
+#[lang = "sized"]
+trait Sized {}
+
+// Test that the riscv interrupt ABIs cannot be used when riscv_interrupt
+// feature gate is not used.
+
+extern "riscv-interrupt-m" fn f() {}
+//~^ ERROR riscv-interrupt ABIs are experimental
+extern "riscv-interrupt-s" fn f_s() {}
+//~^ ERROR riscv-interrupt ABIs are experimental
+
+trait T {
+ extern "riscv-interrupt-m" fn m();
+ //~^ ERROR riscv-interrupt ABIs are experimental
+}
+
+struct S;
+impl T for S {
+ extern "riscv-interrupt-m" fn m() {}
+ //~^ ERROR riscv-interrupt ABIs are experimental
+}
+
+impl S {
+ extern "riscv-interrupt-m" fn im() {}
+ //~^ ERROR riscv-interrupt ABIs are experimental
+}
+
+type TA = extern "riscv-interrupt-m" fn();
+//~^ ERROR riscv-interrupt ABIs are experimental
diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr
new file mode 100644
index 000000000..60c7fa0ea
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr
@@ -0,0 +1,57 @@
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:11:8
+ |
+LL | extern "riscv-interrupt-m" fn f() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:13:8
+ |
+LL | extern "riscv-interrupt-s" fn f_s() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:17:12
+ |
+LL | extern "riscv-interrupt-m" fn m();
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:23:12
+ |
+LL | extern "riscv-interrupt-m" fn m() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:28:12
+ |
+LL | extern "riscv-interrupt-m" fn im() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:32:18
+ |
+LL | type TA = extern "riscv-interrupt-m" fn();
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-cfg-relocation-model.rs b/tests/ui/feature-gates/feature-gate-cfg-relocation-model.rs
new file mode 100644
index 000000000..7529014ec
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-cfg-relocation-model.rs
@@ -0,0 +1,4 @@
+#[cfg(relocation_model = "pic")] //~ ERROR
+fn _foo() {}
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-cfg-relocation-model.stderr b/tests/ui/feature-gates/feature-gate-cfg-relocation-model.stderr
new file mode 100644
index 000000000..592768a42
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-cfg-relocation-model.stderr
@@ -0,0 +1,12 @@
+error[E0658]: `cfg(relocation_model)` is experimental and subject to change
+ --> $DIR/feature-gate-cfg-relocation-model.rs:1:7
+ |
+LL | #[cfg(relocation_model = "pic")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #114929 <https://github.com/rust-lang/rust/issues/114929> for more information
+ = help: add `#![feature(cfg_relocation_model)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
index 3bae23a4a..7de67da9b 100644
--- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
+++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
@@ -13,6 +13,15 @@ LL | let _: u8 = ::core::default::Default();
| ^^^^ maybe a missing crate `core`?
|
= help: consider adding `extern crate core` to use the `core` crate
+help: consider importing this module
+ |
+LL + use std::default;
+ |
+help: if you import `default`, refer to it directly
+ |
+LL - let _: u8 = ::core::default::Default();
+LL + let _: u8 = default::Default();
+ |
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.rs b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
index 7e8c1eb95..ae12495b5 100644
--- a/tests/ui/feature-gates/feature-gate-return_type_notation.rs
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
@@ -1,10 +1,7 @@
// edition: 2021
-// revisions: cfg_current cfg_next no_current no_next
-// [cfg_next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// [no_next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: cfg no
-// [no_current] check-pass
-// [no_next] check-pass
+// [no] check-pass
// Since we're not adding new syntax, `cfg`'d out RTN must pass.
#![feature(async_fn_in_trait)]
@@ -13,17 +10,12 @@ trait Trait {
async fn m();
}
-#[cfg(any(cfg_current, cfg_next))]
+#[cfg(cfg)]
fn foo<T: Trait<m(): Send>>() {}
-//[cfg_current]~^ ERROR return type notation is experimental
-//[cfg_current]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
-//[cfg_current]~| ERROR associated type `m` not found for `Trait`
-//[cfg_next]~^^^^ ERROR return type notation is experimental
-//[cfg_next]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
-//[cfg_next]~| ERROR associated type `m` not found for `Trait`
-//[no_current]~^^^^^^^ WARN return type notation is experimental
-//[no_current]~| WARN unstable syntax can change at any point in the future, causing a hard error!
-//[no_next]~^^^^^^^^^ WARN return type notation is experimental
-//[no_next]~| WARN unstable syntax can change at any point in the future, causing a hard error!
+//[cfg]~^ ERROR return type notation is experimental
+//[cfg]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
+//[cfg]~| ERROR associated type `m` not found for `Trait`
+//[no]~^^^^ WARN return type notation is experimental
+//[no]~| WARN unstable syntax can change at any point in the future, causing a hard error!
fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-thiscall.rs b/tests/ui/feature-gates/feature-gate-thiscall.rs
deleted file mode 100644
index 97a732bcf..000000000
--- a/tests/ui/feature-gates/feature-gate-thiscall.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// gate-test-abi_thiscall
-// needs-llvm-components: x86
-// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib
-#![no_core]
-#![feature(no_core, lang_items)]
-#[lang="sized"]
-trait Sized { }
-
-// Test that the "thiscall" ABI is feature-gated, and cannot be used when
-// the `abi_thiscall` feature gate is not used.
-
-extern "thiscall-unwind" fn fu() {} //~ ERROR thiscall-unwind ABI is experimental
-extern "thiscall" fn f() {} //~ ERROR thiscall is experimental
-
-trait T {
- extern "thiscall" fn m(); //~ ERROR thiscall is experimental
- extern "thiscall-unwind" fn mu(); //~ ERROR thiscall-unwind ABI is experimental
-
- extern "thiscall" fn dm() {} //~ ERROR thiscall is experimental
- extern "thiscall-unwind" fn dmu() {} //~ ERROR thiscall-unwind ABI is experimental
-}
-
-struct S;
-impl T for S {
- extern "thiscall" fn m() {} //~ ERROR thiscall is experimental
- extern "thiscall-unwind" fn mu() {} //~ ERROR thiscall-unwind ABI is experimental
-}
-
-impl S {
- extern "thiscall" fn im() {} //~ ERROR thiscall is experimental
- extern "thiscall-unwind" fn imu() {} //~ ERROR thiscall-unwind ABI is experimental
-}
-
-type TA = extern "thiscall" fn(); //~ ERROR thiscall is experimental
-type TAU = extern "thiscall-unwind" fn(); //~ ERROR thiscall-unwind ABI is experimental
-
-extern "thiscall" {} //~ ERROR thiscall is experimental
-extern "thiscall-unwind" {} //~ ERROR thiscall-unwind ABI is experimental
diff --git a/tests/ui/feature-gates/feature-gate-thiscall.stderr b/tests/ui/feature-gates/feature-gate-thiscall.stderr
deleted file mode 100644
index 346e45952..000000000
--- a/tests/ui/feature-gates/feature-gate-thiscall.stderr
+++ /dev/null
@@ -1,115 +0,0 @@
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:12:8
- |
-LL | extern "thiscall-unwind" fn fu() {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:13:8
- |
-LL | extern "thiscall" fn f() {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:16:12
- |
-LL | extern "thiscall" fn m();
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:17:12
- |
-LL | extern "thiscall-unwind" fn mu();
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:19:12
- |
-LL | extern "thiscall" fn dm() {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:20:12
- |
-LL | extern "thiscall-unwind" fn dmu() {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:25:12
- |
-LL | extern "thiscall" fn m() {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:26:12
- |
-LL | extern "thiscall-unwind" fn mu() {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:30:12
- |
-LL | extern "thiscall" fn im() {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:31:12
- |
-LL | extern "thiscall-unwind" fn imu() {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:34:18
- |
-LL | type TA = extern "thiscall" fn();
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:35:19
- |
-LL | type TAU = extern "thiscall-unwind" fn();
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:37:8
- |
-LL | extern "thiscall" {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:38:8
- |
-LL | extern "thiscall-unwind" {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error: aborting due to 14 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
index dce94c9ea..134ea25b7 100644
--- a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
+++ b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
@@ -1,7 +1,7 @@
// edition:2018
-#![forbid(incomplete_features, unsafe_code)]
+#![forbid(internal_features, unsafe_code)]
#![feature(unsafe_pin_internals)]
-//~^ ERROR the feature `unsafe_pin_internals` is incomplete and may not be safe to use
+//~^ ERROR the feature `unsafe_pin_internals` is internal to the compiler or standard library
use core::{marker::PhantomPinned, pin::Pin};
diff --git a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr
index 4d0c931b4..39afbf2db 100644
--- a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr
+++ b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr
@@ -1,14 +1,15 @@
-error: the feature `unsafe_pin_internals` is incomplete and may not be safe to use and/or cause compiler crashes
+error: the feature `unsafe_pin_internals` is internal to the compiler or standard library
--> $DIR/feature-gate-unsafe_pin_internals.rs:3:12
|
LL | #![feature(unsafe_pin_internals)]
| ^^^^^^^^^^^^^^^^^^^^
|
+ = note: using it is strongly discouraged
note: the lint level is defined here
--> $DIR/feature-gate-unsafe_pin_internals.rs:2:11
|
-LL | #![forbid(incomplete_features, unsafe_code)]
- | ^^^^^^^^^^^^^^^^^^^
+LL | #![forbid(internal_features, unsafe_code)]
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/feature-gates/print-with-path.cfg.stderr b/tests/ui/feature-gates/print-with-path.cfg.stderr
new file mode 100644
index 000000000..a6c51baa3
--- /dev/null
+++ b/tests/ui/feature-gates/print-with-path.cfg.stderr
@@ -0,0 +1,2 @@
+error: the `-Z unstable-options` flag must also be passed to enable the path print option
+
diff --git a/tests/ui/feature-gates/print-with-path.rs b/tests/ui/feature-gates/print-with-path.rs
new file mode 100644
index 000000000..f929c14c2
--- /dev/null
+++ b/tests/ui/feature-gates/print-with-path.rs
@@ -0,0 +1,7 @@
+// check-fail
+// revisions: cfg target-features target-cpus
+// [cfg]compile-flags: --print cfg=cfg.txt
+// [target-cpus]compile-flags: --print target-cpu=target_cpu.txt
+// [target-features]compile-flags: --print target-features=target_features.txt
+
+fn main() {}
diff --git a/tests/ui/feature-gates/print-with-path.target-cpus.stderr b/tests/ui/feature-gates/print-with-path.target-cpus.stderr
new file mode 100644
index 000000000..a6c51baa3
--- /dev/null
+++ b/tests/ui/feature-gates/print-with-path.target-cpus.stderr
@@ -0,0 +1,2 @@
+error: the `-Z unstable-options` flag must also be passed to enable the path print option
+
diff --git a/tests/ui/feature-gates/print-with-path.target-features.stderr b/tests/ui/feature-gates/print-with-path.target-features.stderr
new file mode 100644
index 000000000..a6c51baa3
--- /dev/null
+++ b/tests/ui/feature-gates/print-with-path.target-features.stderr
@@ -0,0 +1,2 @@
+error: the `-Z unstable-options` flag must also be passed to enable the path print option
+