about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/target-feature/auxiliary/using-target-feature-unstable.rs (renamed from tests/ui/auxiliary/using-target-feature-unstable.rs)0
-rw-r--r--tests/ui/target-feature/forbidden-target-feature-attribute.rs12
-rw-r--r--tests/ui/target-feature/forbidden-target-feature-attribute.stderr8
-rw-r--r--tests/ui/target-feature/forbidden-target-feature-cfg.rs15
-rw-r--r--tests/ui/target-feature/forbidden-target-feature-flag-disable.rs11
-rw-r--r--tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr7
-rw-r--r--tests/ui/target-feature/forbidden-target-feature-flag.rs11
-rw-r--r--tests/ui/target-feature/forbidden-target-feature-flag.stderr7
-rw-r--r--tests/ui/target-feature/using-target-feature-unstable.rs (renamed from tests/ui/using-target-feature-unstable.rs)0
9 files changed, 71 insertions, 0 deletions
diff --git a/tests/ui/auxiliary/using-target-feature-unstable.rs b/tests/ui/target-feature/auxiliary/using-target-feature-unstable.rs
index 2682028936c..2682028936c 100644
--- a/tests/ui/auxiliary/using-target-feature-unstable.rs
+++ b/tests/ui/target-feature/auxiliary/using-target-feature-unstable.rs
diff --git a/tests/ui/target-feature/forbidden-target-feature-attribute.rs b/tests/ui/target-feature/forbidden-target-feature-attribute.rs
new file mode 100644
index 00000000000..91c56b43689
--- /dev/null
+++ b/tests/ui/target-feature/forbidden-target-feature-attribute.rs
@@ -0,0 +1,12 @@
+//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib
+//@ needs-llvm-components: x86
+#![feature(no_core, lang_items)]
+#![no_std]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
+
+#[target_feature(enable = "soft-float")]
+//~^ERROR: cannot be toggled with
+pub unsafe fn my_fun() {}
diff --git a/tests/ui/target-feature/forbidden-target-feature-attribute.stderr b/tests/ui/target-feature/forbidden-target-feature-attribute.stderr
new file mode 100644
index 00000000000..fb318531f7e
--- /dev/null
+++ b/tests/ui/target-feature/forbidden-target-feature-attribute.stderr
@@ -0,0 +1,8 @@
+error: target feature `soft-float` cannot be toggled with `#[target_feature]`: unsound because it changes float ABI
+  --> $DIR/forbidden-target-feature-attribute.rs:10:18
+   |
+LL | #[target_feature(enable = "soft-float")]
+   |                  ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/target-feature/forbidden-target-feature-cfg.rs b/tests/ui/target-feature/forbidden-target-feature-cfg.rs
new file mode 100644
index 00000000000..5df26e26793
--- /dev/null
+++ b/tests/ui/target-feature/forbidden-target-feature-cfg.rs
@@ -0,0 +1,15 @@
+//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib
+//@ needs-llvm-components: x86
+//@ check-pass
+#![feature(no_core, lang_items)]
+#![no_std]
+#![no_core]
+#![allow(unexpected_cfgs)]
+
+#[lang = "sized"]
+pub trait Sized {}
+
+// The compile_error macro does not exist, so if the `cfg` evaluates to `true` this
+// complains about the missing macro rather than showing the error... but that's good enough.
+#[cfg(target_feature = "soft-float")]
+compile_error!("the soft-float feature should not be exposed in `cfg`");
diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs
new file mode 100644
index 00000000000..b27e8a10afe
--- /dev/null
+++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs
@@ -0,0 +1,11 @@
+//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib
+//@ needs-llvm-components: x86
+//@ compile-flags: -Ctarget-feature=-soft-float
+// For now this is just a warning.
+//@ build-pass
+#![feature(no_core, lang_items)]
+#![no_std]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr b/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr
new file mode 100644
index 00000000000..508e1fe0cf4
--- /dev/null
+++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr
@@ -0,0 +1,7 @@
+warning: target feature `soft-float` cannot be toggled with `-Ctarget-feature`: unsound because it changes float ABI
+   |
+   = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.rs b/tests/ui/target-feature/forbidden-target-feature-flag.rs
new file mode 100644
index 00000000000..93cebc6b536
--- /dev/null
+++ b/tests/ui/target-feature/forbidden-target-feature-flag.rs
@@ -0,0 +1,11 @@
+//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib
+//@ needs-llvm-components: x86
+//@ compile-flags: -Ctarget-feature=+soft-float
+// For now this is just a warning.
+//@ build-pass
+#![feature(no_core, lang_items)]
+#![no_std]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.stderr b/tests/ui/target-feature/forbidden-target-feature-flag.stderr
new file mode 100644
index 00000000000..508e1fe0cf4
--- /dev/null
+++ b/tests/ui/target-feature/forbidden-target-feature-flag.stderr
@@ -0,0 +1,7 @@
+warning: target feature `soft-float` cannot be toggled with `-Ctarget-feature`: unsound because it changes float ABI
+   |
+   = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/using-target-feature-unstable.rs b/tests/ui/target-feature/using-target-feature-unstable.rs
index 5ec0bda5eef..5ec0bda5eef 100644
--- a/tests/ui/using-target-feature-unstable.rs
+++ b/tests/ui/target-feature/using-target-feature-unstable.rs