summary refs log tree commit diff
path: root/src/test/ui/target-feature
diff options
context:
space:
mode:
authorCaleb Zulawski <caleb.zulawski@gmail.com>2020-06-14 00:47:42 -0400
committerCaleb Zulawski <caleb.zulawski@gmail.com>2020-09-05 20:45:43 -0400
commit4efe97a3d9a5f2d295bc2fa9bd2bb90edf1986d5 (patch)
treeef7b2d81a2d2b0c2f467631d6585a038bd200e1c /src/test/ui/target-feature
parentde921ab3c3aa25d65b1476d77285da1ca99af397 (diff)
downloadrust-4efe97a3d9a5f2d295bc2fa9bd2bb90edf1986d5.tar.gz
rust-4efe97a3d9a5f2d295bc2fa9bd2bb90edf1986d5.zip
Check placement of more attributes
Diffstat (limited to 'src/test/ui/target-feature')
-rw-r--r--src/test/ui/target-feature/invalid-attribute.rs9
-rw-r--r--src/test/ui/target-feature/invalid-attribute.stderr25
2 files changed, 23 insertions, 11 deletions
diff --git a/src/test/ui/target-feature/invalid-attribute.rs b/src/test/ui/target-feature/invalid-attribute.rs
index 98afded6712..3c2e34bb8c3 100644
--- a/src/test/ui/target-feature/invalid-attribute.rs
+++ b/src/test/ui/target-feature/invalid-attribute.rs
@@ -79,13 +79,16 @@ impl Quux for Foo {
 }
 
 fn main() {
+    #[target_feature(enable = "sse2")]
+    //~^ ERROR attribute should be applied to a function
     unsafe {
         foo();
         bar();
     }
+    //~^^^^ NOTE not a function
+
     #[target_feature(enable = "sse2")]
-    //~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
-    //~| NOTE see issue #69098
+    //~^ ERROR attribute should be applied to a function
     || {};
-    //~^ NOTE not an `unsafe` function
+    //~^ NOTE not a function
 }
diff --git a/src/test/ui/target-feature/invalid-attribute.stderr b/src/test/ui/target-feature/invalid-attribute.stderr
index 3d629afb9a6..c06538c5b8f 100644
--- a/src/test/ui/target-feature/invalid-attribute.stderr
+++ b/src/test/ui/target-feature/invalid-attribute.stderr
@@ -94,17 +94,26 @@ error: cannot use `#[inline(always)]` with `#[target_feature]`
 LL | #[inline(always)]
    | ^^^^^^^^^^^^^^^^^
 
-error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
-  --> $DIR/invalid-attribute.rs:86:5
+error: attribute should be applied to a function
+  --> $DIR/invalid-attribute.rs:82:5
+   |
+LL |       #[target_feature(enable = "sse2")]
+   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | /     unsafe {
+LL | |         foo();
+LL | |         bar();
+LL | |     }
+   | |_____- not a function
+
+error: attribute should be applied to a function
+  --> $DIR/invalid-attribute.rs:90:5
    |
 LL |     #[target_feature(enable = "sse2")]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-...
+LL |
 LL |     || {};
-   |     ----- not an `unsafe` function
-   |
-   = note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
-   = help: add `#![feature(target_feature_11)]` to the crate attributes to enable
+   |     ----- not a function
 
 error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
   --> $DIR/invalid-attribute.rs:74:5
@@ -118,6 +127,6 @@ LL |     fn foo() {}
    = note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
    = help: add `#![feature(target_feature_11)]` to the crate attributes to enable
 
-error: aborting due to 14 previous errors
+error: aborting due to 15 previous errors
 
 For more information about this error, try `rustc --explain E0658`.