about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAdam Gemmell <adam.gemmell@arm.com>2022-01-31 13:04:27 +0000
committerAdam Gemmell <adam.gemmell@arm.com>2022-02-10 15:10:33 +0000
commitd39a6377e9cfa108eb181ea892366e6b01fd753f (patch)
treebd6e7fb2d02092d8b2ef107b0ab1f836b361831b /src/test
parent56cd04af5c389b6ab676ba16f59d9f70bc465090 (diff)
downloadrust-d39a6377e9cfa108eb181ea892366e6b01fd753f.tar.gz
rust-d39a6377e9cfa108eb181ea892366e6b01fd753f.zip
Split PAuth target feature
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/target-feature/tied-features-cli.one.stderr4
-rw-r--r--src/test/ui/target-feature/tied-features-cli.rs9
-rw-r--r--src/test/ui/target-feature/tied-features-cli.three.stderr4
-rw-r--r--src/test/ui/target-feature/tied-features-cli.two.stderr4
-rw-r--r--src/test/ui/target-feature/tied-features.rs29
-rw-r--r--src/test/ui/target-feature/tied-features.stderr18
6 files changed, 68 insertions, 0 deletions
diff --git a/src/test/ui/target-feature/tied-features-cli.one.stderr b/src/test/ui/target-feature/tied-features-cli.one.stderr
new file mode 100644
index 00000000000..2bc64a76aae
--- /dev/null
+++ b/src/test/ui/target-feature/tied-features-cli.one.stderr
@@ -0,0 +1,4 @@
+error: Target features paca, pacg must all be enabled or disabled together
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/target-feature/tied-features-cli.rs b/src/test/ui/target-feature/tied-features-cli.rs
new file mode 100644
index 00000000000..ea09d4fc460
--- /dev/null
+++ b/src/test/ui/target-feature/tied-features-cli.rs
@@ -0,0 +1,9 @@
+// only-aarch64
+// revisions: one two three four
+//[one] compile-flags: -C target-feature=+paca
+//[two] compile-flags: -C target-feature=-pacg,+pacg
+//[three] compile-flags: -C target-feature=+paca,+pacg,-paca
+//[four] check-pass
+//[four] compile-flags: -C target-feature=-paca,+pacg -C target-feature=+paca
+
+fn main() {}
diff --git a/src/test/ui/target-feature/tied-features-cli.three.stderr b/src/test/ui/target-feature/tied-features-cli.three.stderr
new file mode 100644
index 00000000000..2bc64a76aae
--- /dev/null
+++ b/src/test/ui/target-feature/tied-features-cli.three.stderr
@@ -0,0 +1,4 @@
+error: Target features paca, pacg must all be enabled or disabled together
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/target-feature/tied-features-cli.two.stderr b/src/test/ui/target-feature/tied-features-cli.two.stderr
new file mode 100644
index 00000000000..2bc64a76aae
--- /dev/null
+++ b/src/test/ui/target-feature/tied-features-cli.two.stderr
@@ -0,0 +1,4 @@
+error: Target features paca, pacg must all be enabled or disabled together
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/target-feature/tied-features.rs b/src/test/ui/target-feature/tied-features.rs
new file mode 100644
index 00000000000..86400361db3
--- /dev/null
+++ b/src/test/ui/target-feature/tied-features.rs
@@ -0,0 +1,29 @@
+// only-aarch64
+// build-fail
+
+#![feature(aarch64_target_feature, target_feature_11)]
+
+fn main() {
+    #[target_feature(enable = "pacg")]
+    //~^ ERROR must all be either enabled or disabled together
+    unsafe fn inner() {}
+
+    unsafe {
+        foo();
+        bar();
+        baz();
+        inner();
+    }
+}
+
+#[target_feature(enable = "paca")]
+//~^ ERROR must all be either enabled or disabled together
+unsafe fn foo() {}
+
+
+#[target_feature(enable = "paca,pacg")]
+unsafe fn bar() {}
+
+#[target_feature(enable = "paca")]
+#[target_feature(enable = "pacg")]
+unsafe fn baz() {}
diff --git a/src/test/ui/target-feature/tied-features.stderr b/src/test/ui/target-feature/tied-features.stderr
new file mode 100644
index 00000000000..0b1460e0b75
--- /dev/null
+++ b/src/test/ui/target-feature/tied-features.stderr
@@ -0,0 +1,18 @@
+error: the target features paca, pacg must all be either enabled or disabled together
+  --> $DIR/tied-features.rs:7:5
+   |
+LL |     #[target_feature(enable = "pacg")]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add the missing features in a `target_feature` attribute
+
+error: the target features paca, pacg must all be either enabled or disabled together
+  --> $DIR/tied-features.rs:19:1
+   |
+LL | #[target_feature(enable = "paca")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add the missing features in a `target_feature` attribute
+
+error: aborting due to 2 previous errors
+