about summary refs log tree commit diff
path: root/src
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
parentde921ab3c3aa25d65b1476d77285da1ca99af397 (diff)
downloadrust-4efe97a3d9a5f2d295bc2fa9bd2bb90edf1986d5.tar.gz
rust-4efe97a3d9a5f2d295bc2fa9bd2bb90edf1986d5.zip
Check placement of more attributes
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/check-static-recursion-foreign.rs2
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.rs171
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.stderr274
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs73
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr264
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-inline.rs31
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr52
-rw-r--r--src/test/ui/issues/issue-2214.rs2
-rw-r--r--src/test/ui/issues/issue-47725.rs22
-rw-r--r--src/test/ui/issues/issue-47725.stderr50
-rw-r--r--src/test/ui/issues/issue-54044.rs7
-rw-r--r--src/test/ui/issues/issue-54044.stderr18
-rw-r--r--src/test/ui/macros/issue-68060.rs7
-rw-r--r--src/test/ui/macros/issue-68060.stderr22
-rw-r--r--src/test/ui/target-feature/invalid-attribute.rs9
-rw-r--r--src/test/ui/target-feature/invalid-attribute.stderr25
16 files changed, 700 insertions, 329 deletions
diff --git a/src/test/ui/check-static-recursion-foreign.rs b/src/test/ui/check-static-recursion-foreign.rs
index 8ca0af8e47a..536d7933d3e 100644
--- a/src/test/ui/check-static-recursion-foreign.rs
+++ b/src/test/ui/check-static-recursion-foreign.rs
@@ -15,7 +15,7 @@ extern crate libc;
 
 use libc::c_int;
 
-#[link_name = "check_static_recursion_foreign_helper"]
+#[link(name = "check_static_recursion_foreign_helper")]
 extern "C" {
     #[allow(dead_code)]
     static test_static: c_int;
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.rs
new file mode 100644
index 00000000000..06cc868994e
--- /dev/null
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.rs
@@ -0,0 +1,171 @@
+// This is testing whether various builtin attributes signals an
+// error or warning when put in "weird" places.
+//
+// (This file sits on its own because it actually signals an error,
+// which would mess up the treatment of other cases in
+// issue-43106-gating-of-builtin-attrs.rs)
+
+// ignore-tidy-linelength
+
+// Crate-level is accepted, though it is almost certainly unused?
+#![inline]
+
+#[inline]
+//~^ ERROR attribute should be applied to function or closure
+mod inline {
+    //~^ NOTE not a function or closure
+
+    mod inner { #![inline] }
+    //~^ ERROR attribute should be applied to function or closure
+    //~| NOTE not a function or closure
+
+    #[inline = "2100"] fn f() { }
+    //~^ ERROR attribute must be of the form
+    //~| WARN this was previously accepted
+    //~| NOTE #[deny(ill_formed_attribute_input)]` on by default
+    //~| NOTE for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
+
+    #[inline] struct S;
+    //~^ ERROR attribute should be applied to function or closure
+    //~| NOTE not a function or closure
+
+    #[inline] type T = S;
+    //~^ ERROR attribute should be applied to function or closure
+    //~| NOTE not a function or closure
+
+    #[inline] impl S { }
+    //~^ ERROR attribute should be applied to function or closure
+    //~| NOTE not a function or closure
+}
+
+#[no_link]
+//~^ ERROR attribute should be applied to an `extern crate` item
+mod no_link {
+    //~^ NOTE not an `extern crate` item
+
+    mod inner { #![no_link] }
+    //~^ ERROR attribute should be applied to an `extern crate` item
+    //~| NOTE not an `extern crate` item
+
+    #[no_link] fn f() { }
+    //~^ ERROR attribute should be applied to an `extern crate` item
+    //~| NOTE not an `extern crate` item
+
+    #[no_link] struct S;
+    //~^ ERROR attribute should be applied to an `extern crate` item
+    //~| NOTE not an `extern crate` item
+
+    #[no_link]type T = S;
+    //~^ ERROR attribute should be applied to an `extern crate` item
+    //~| NOTE not an `extern crate` item
+
+    #[no_link] impl S { }
+    //~^ ERROR attribute should be applied to an `extern crate` item
+    //~| NOTE not an `extern crate` item
+}
+
+#[cold]
+//~^ ERROR attribute should be applied to a function
+mod cold {
+    //~^ NOTE not a function
+
+    mod inner { #![cold] }
+    //~^ ERROR attribute should be applied to a function
+    //~| NOTE not a function
+
+    #[cold] fn f() { }
+
+    #[cold] struct S;
+    //~^ ERROR attribute should be applied to a function
+    //~| NOTE not a function
+
+    #[cold] type T = S;
+    //~^ ERROR attribute should be applied to a function
+    //~| NOTE not a function
+
+    #[cold] impl S { }
+    //~^ ERROR attribute should be applied to a function
+    //~| NOTE not a function
+}
+
+#[export_name = "2200"]
+//~^ ERROR attribute should be applied to a function or static
+mod export_name {
+    //~^ NOTE not a function or static
+
+    mod inner { #![export_name="2200"] }
+    //~^ ERROR attribute should be applied to a function or static
+    //~| NOTE not a function or static
+
+    #[export_name = "2200"] fn f() { }
+
+    #[export_name = "2200"] struct S;
+    //~^ ERROR attribute should be applied to a function or static
+    //~| NOTE not a function or static
+
+    #[export_name = "2200"] type T = S;
+    //~^ ERROR attribute should be applied to a function or static
+    //~| NOTE not a function or static
+
+    #[export_name = "2200"] impl S { }
+    //~^ ERROR attribute should be applied to a function or static
+    //~| NOTE not a function or static
+}
+
+#[link_name = "1900"]
+//~^ ERROR attribute should be applied to a foreign function or static
+mod link_name {
+    //~^ NOTE not a foreign function or static
+
+    #[link_name = "1900"]
+    //~^ ERROR attribute should be applied to a foreign function or static
+    //~| HELP try `#[link(name = "1900")]` instead
+    extern { }
+    //~^ NOTE not a foreign function or static
+
+    mod inner { #![link_name="1900"] }
+    //~^ ERROR attribute should be applied to a foreign function or static
+    //~| NOTE not a foreign function or static
+
+    #[link_name = "1900"] fn f() { }
+    //~^ ERROR attribute should be applied to a foreign function or static
+    //~| NOTE not a foreign function or static
+
+    #[link_name = "1900"] struct S;
+    //~^ ERROR attribute should be applied to a foreign function or static
+    //~| NOTE not a foreign function or static
+
+    #[link_name = "1900"] type T = S;
+    //~^ ERROR attribute should be applied to a foreign function or static
+    //~| NOTE not a foreign function or static
+
+    #[link_name = "1900"] impl S { }
+    //~^ ERROR attribute should be applied to a foreign function or static
+    //~| NOTE not a foreign function or static
+}
+
+#[link_section = "1800"]
+//~^ ERROR attribute should be applied to a function or static
+mod link_section {
+    //~^ NOTE not a function or static
+
+    mod inner { #![link_section="1800"] }
+    //~^ ERROR attribute should be applied to a function or static
+    //~| NOTE not a function or static
+
+    #[link_section = "1800"] fn f() { }
+
+    #[link_section = "1800"] struct S;
+    //~^ ERROR attribute should be applied to a function or static
+    //~| NOTE not a function or static
+
+    #[link_section = "1800"] type T = S;
+    //~^ ERROR attribute should be applied to a function or static
+    //~| NOTE not a function or static
+
+    #[link_section = "1800"] impl S { }
+    //~^ ERROR attribute should be applied to a function or static
+    //~| NOTE not a function or static
+}
+
+fn main() {}
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.stderr
new file mode 100644
index 00000000000..7b18774b6e5
--- /dev/null
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs-error.stderr
@@ -0,0 +1,274 @@
+error: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:22:5
+   |
+LL |     #[inline = "2100"] fn f() { }
+   |     ^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[deny(ill_formed_attribute_input)]` on by default
+   = warning: 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
+
+error[E0518]: attribute should be applied to function or closure
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:13:1
+   |
+LL |   #[inline]
+   |   ^^^^^^^^^
+LL |
+LL | / mod inline {
+LL | |
+LL | |
+LL | |     mod inner { #![inline] }
+...  |
+LL | |
+LL | | }
+   | |_- not a function or closure
+
+error: attribute should be applied to an `extern crate` item
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:41:1
+   |
+LL |   #[no_link]
+   |   ^^^^^^^^^^
+LL |
+LL | / mod no_link {
+LL | |
+LL | |
+LL | |     mod inner { #![no_link] }
+...  |
+LL | |
+LL | | }
+   | |_- not an `extern crate` item
+
+error: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:67:1
+   |
+LL |   #[cold]
+   |   ^^^^^^^
+LL |
+LL | / mod cold {
+LL | |
+LL | |
+LL | |     mod inner { #![cold] }
+...  |
+LL | |
+LL | | }
+   | |_- not a function
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91:1
+   |
+LL |   #[export_name = "2200"]
+   |   ^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / mod export_name {
+LL | |
+LL | |
+LL | |     mod inner { #![export_name="2200"] }
+...  |
+LL | |
+LL | | }
+   | |_- not a function or static
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:115:1
+   |
+LL |   #[link_name = "1900"]
+   |   ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / mod link_name {
+LL | |
+LL | |
+LL | |     #[link_name = "1900"]
+...  |
+LL | |
+LL | | }
+   | |_- not a foreign function or static
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:147:1
+   |
+LL |   #[link_section = "1800"]
+   |   ^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / mod link_section {
+LL | |
+LL | |
+LL | |     mod inner { #![link_section="1800"] }
+...  |
+LL | |
+LL | | }
+   | |_- not a function or static
+
+error[E0518]: attribute should be applied to function or closure
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:18:17
+   |
+LL |     mod inner { #![inline] }
+   |     ------------^^^^^^^^^^-- not a function or closure
+
+error[E0518]: attribute should be applied to function or closure
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:28:5
+   |
+LL |     #[inline] struct S;
+   |     ^^^^^^^^^ --------- not a function or closure
+
+error[E0518]: attribute should be applied to function or closure
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:32:5
+   |
+LL |     #[inline] type T = S;
+   |     ^^^^^^^^^ ----------- not a function or closure
+
+error[E0518]: attribute should be applied to function or closure
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:36:5
+   |
+LL |     #[inline] impl S { }
+   |     ^^^^^^^^^ ---------- not a function or closure
+
+error: attribute should be applied to an `extern crate` item
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:17
+   |
+LL |     mod inner { #![no_link] }
+   |     ------------^^^^^^^^^^^-- not an `extern crate` item
+
+error: attribute should be applied to an `extern crate` item
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:50:5
+   |
+LL |     #[no_link] fn f() { }
+   |     ^^^^^^^^^^ ---------- not an `extern crate` item
+
+error: attribute should be applied to an `extern crate` item
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:54:5
+   |
+LL |     #[no_link] struct S;
+   |     ^^^^^^^^^^ --------- not an `extern crate` item
+
+error: attribute should be applied to an `extern crate` item
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:58:5
+   |
+LL |     #[no_link]type T = S;
+   |     ^^^^^^^^^^----------- not an `extern crate` item
+
+error: attribute should be applied to an `extern crate` item
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:62:5
+   |
+LL |     #[no_link] impl S { }
+   |     ^^^^^^^^^^ ---------- not an `extern crate` item
+
+error: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:72:17
+   |
+LL |     mod inner { #![cold] }
+   |     ------------^^^^^^^^-- not a function
+
+error: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:78:5
+   |
+LL |     #[cold] struct S;
+   |     ^^^^^^^ --------- not a function
+
+error: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:82:5
+   |
+LL |     #[cold] type T = S;
+   |     ^^^^^^^ ----------- not a function
+
+error: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:86:5
+   |
+LL |     #[cold] impl S { }
+   |     ^^^^^^^ ---------- not a function
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:17
+   |
+LL |     mod inner { #![export_name="2200"] }
+   |     ------------^^^^^^^^^^^^^^^^^^^^^^-- not a function or static
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:102:5
+   |
+LL |     #[export_name = "2200"] struct S;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a function or static
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:5
+   |
+LL |     #[export_name = "2200"] type T = S;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a function or static
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:110:5
+   |
+LL |     #[export_name = "2200"] impl S { }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a function or static
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:120:5
+   |
+LL |     #[link_name = "1900"]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+...
+LL |     extern { }
+   |     ---------- not a foreign function or static
+   |
+help: try `#[link(name = "1900")]` instead
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:120:5
+   |
+LL |     #[link_name = "1900"]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:126:17
+   |
+LL |     mod inner { #![link_name="1900"] }
+   |     ------------^^^^^^^^^^^^^^^^^^^^-- not a foreign function or static
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:130:5
+   |
+LL |     #[link_name = "1900"] fn f() { }
+   |     ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:134:5
+   |
+LL |     #[link_name = "1900"] struct S;
+   |     ^^^^^^^^^^^^^^^^^^^^^ --------- not a foreign function or static
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:138:5
+   |
+LL |     #[link_name = "1900"] type T = S;
+   |     ^^^^^^^^^^^^^^^^^^^^^ ----------- not a foreign function or static
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:142:5
+   |
+LL |     #[link_name = "1900"] impl S { }
+   |     ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:152:17
+   |
+LL |     mod inner { #![link_section="1800"] }
+   |     ------------^^^^^^^^^^^^^^^^^^^^^^^-- not a function or static
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:158:5
+   |
+LL |     #[link_section = "1800"] struct S;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ --------- not a function or static
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:162:5
+   |
+LL |     #[link_section = "1800"] type T = S;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a function or static
+
+error: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:166:5
+   |
+LL |     #[link_section = "1800"] impl S { }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a function or static
+
+error: aborting due to 34 previous errors
+
+For more information about this error, try `rustc --explain E0518`.
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs
index f702b10ccd1..aea1ce6f5ae 100644
--- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs
@@ -72,7 +72,7 @@
 #![doc = "2400"]
 #![cold]
 #![export_name = "2200"]
-// see issue-43106-gating-of-inline.rs
+// see issue-43106-gating-of-builtin-attrs-error.rs
 #![link()]
 #![link_name = "1900"]
 #![link_section = "1800"]
@@ -367,25 +367,6 @@ mod no_mangle {
     #[no_mangle] impl S { }
 }
 
-#[no_link]
-//~^ WARN unused attribute
-mod no_link {
-    mod inner { #![no_link] }
-    //~^ WARN unused attribute
-
-    #[no_link] fn f() { }
-    //~^ WARN unused attribute
-
-    #[no_link] struct S;
-    //~^ WARN unused attribute
-
-    #[no_link]type T = S;
-    //~^ WARN unused attribute
-
-    #[no_link] impl S { }
-    //~^ WARN unused attribute
-}
-
 #[should_panic]
 //~^ WARN unused attribute
 mod should_panic {
@@ -524,32 +505,6 @@ mod doc {
     #[doc = "2400"] impl S { }
 }
 
-#[cold]
-mod cold {
-    mod inner { #![cold] }
-
-    #[cold] fn f() { }
-
-    #[cold] struct S;
-
-    #[cold] type T = S;
-
-    #[cold] impl S { }
-}
-
-#[export_name = "2200"]
-mod export_name {
-    mod inner { #![export_name="2200"] }
-
-    #[export_name = "2200"] fn f() { }
-
-    #[export_name = "2200"] struct S;
-
-    #[export_name = "2200"] type T = S;
-
-    #[export_name = "2200"] impl S { }
-}
-
 // Note that this is a `check-pass` test, so it
 // will never invoke the linker. These are here nonetheless to point
 // out that we allow them at non-crate-level (though I do not know
@@ -568,32 +523,6 @@ mod link {
     #[link()] impl S { }
 }
 
-#[link_name = "1900"]
-mod link_name {
-    mod inner { #![link_name="1900"] }
-
-    #[link_name = "1900"] fn f() { }
-
-    #[link_name = "1900"] struct S;
-
-    #[link_name = "1900"] type T = S;
-
-    #[link_name = "1900"] impl S { }
-}
-
-#[link_section = "1800"]
-mod link_section {
-    mod inner { #![link_section="1800"] }
-
-    #[link_section = "1800"] fn f() { }
-
-    #[link_section = "1800"] struct S;
-
-    #[link_section = "1800"] type T = S;
-
-    #[link_section = "1800"] impl S { }
-}
-
 struct StructForDeprecated;
 
 #[deprecated]
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr
index 02bed6723bf..ebb81275df1 100644
--- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr
@@ -173,13 +173,13 @@ LL |     #[deny(x5100)] impl S { }
    |            ^^^^^
 
 warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:447:1
    |
 LL | #[macro_escape]
    | ^^^^^^^^^^^^^^^
 
 warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:469:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:450:17
    |
 LL |     mod inner { #![macro_escape] }
    |                 ^^^^^^^^^^^^^^^^
@@ -463,707 +463,671 @@ LL | #[automatically_derived]
 warning: unused attribute
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:373:17
    |
-LL |     mod inner { #![no_link] }
-   |                 ^^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5
-   |
-LL |     #[no_link] fn f() { }
-   |     ^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:5
-   |
-LL |     #[no_link] struct S;
-   |     ^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:5
-   |
-LL |     #[no_link]type T = S;
-   |     ^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:385:5
-   |
-LL |     #[no_link] impl S { }
-   |     ^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:1
-   |
-LL | #[no_link]
-   | ^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:17
-   |
 LL |     mod inner { #![should_panic] }
    |                 ^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5
    |
 LL |     #[should_panic] fn f() { }
    |     ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:5
    |
 LL |     #[should_panic] struct S;
    |     ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:5
    |
 LL |     #[should_panic] type T = S;
    |     ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:385:5
    |
 LL |     #[should_panic] impl S { }
    |     ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:1
    |
 LL | #[should_panic]
    | ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:17
    |
 LL |     mod inner { #![ignore] }
    |                 ^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5
    |
 LL |     #[ignore] fn f() { }
    |     ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5
    |
 LL |     #[ignore] struct S;
    |     ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:420:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:5
    |
 LL |     #[ignore] type T = S;
    |     ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:5
    |
 LL |     #[ignore] impl S { }
    |     ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:1
    |
 LL | #[ignore]
    | ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:17
    |
 LL |     mod inner { #![no_implicit_prelude] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5
    |
 LL |     #[no_implicit_prelude] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:436:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:5
    |
 LL |     #[no_implicit_prelude] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:420:5
    |
 LL |     #[no_implicit_prelude] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5
    |
 LL |     #[no_implicit_prelude] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:1
    |
 LL | #[no_implicit_prelude]
    | ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:449:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:17
    |
 LL |     mod inner { #![reexport_test_harness_main="2900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5
    |
 LL |     #[reexport_test_harness_main = "2900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:455:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:436:5
    |
 LL |     #[reexport_test_harness_main = "2900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:5
    |
 LL |     #[reexport_test_harness_main = "2900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:461:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:5
    |
 LL |     #[reexport_test_harness_main = "2900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:1
    |
 LL | #[reexport_test_harness_main = "2900"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:472:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:453:5
    |
 LL |     #[macro_escape] fn f() { }
    |     ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:475:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:456:5
    |
 LL |     #[macro_escape] struct S;
    |     ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:459:5
    |
 LL |     #[macro_escape] type T = S;
    |     ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:481:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:462:5
    |
 LL |     #[macro_escape] impl S { }
    |     ^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:17
    |
 LL |     mod inner { #![no_std] }
    |                 ^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:17
    |
 LL |     mod inner { #![no_std] }
    |                 ^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:493:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:474:5
    |
 LL |     #[no_std] fn f() { }
    |     ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:493:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:474:5
    |
 LL |     #[no_std] fn f() { }
    |     ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:497:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:5
    |
 LL |     #[no_std] struct S;
    |     ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:497:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:5
    |
 LL |     #[no_std] struct S;
    |     ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:501:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:482:5
    |
 LL |     #[no_std] type T = S;
    |     ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:501:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:482:5
    |
 LL |     #[no_std] type T = S;
    |     ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:505:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:5
    |
 LL |     #[no_std] impl S { }
    |     ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:505:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:5
    |
 LL |     #[no_std] impl S { }
    |     ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:485:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:1
    |
 LL | #[no_std]
    | ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:485:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:1
    |
 LL | #[no_std]
    | ^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:644:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:573:17
    |
 LL |     mod inner { #![crate_name="0900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:644:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:573:17
    |
 LL |     mod inner { #![crate_name="0900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:648:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:577:5
    |
 LL |     #[crate_name = "0900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:648:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:577:5
    |
 LL |     #[crate_name = "0900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:581:5
    |
 LL |     #[crate_name = "0900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:581:5
    |
 LL |     #[crate_name = "0900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:656:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:585:5
    |
 LL |     #[crate_name = "0900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:656:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:585:5
    |
 LL |     #[crate_name = "0900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:589:5
    |
 LL |     #[crate_name = "0900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:589:5
    |
 LL |     #[crate_name = "0900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:640:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:569:1
    |
 LL | #[crate_name = "0900"]
    | ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:640:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:569:1
    |
 LL | #[crate_name = "0900"]
    | ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:669:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:598:17
    |
 LL |     mod inner { #![crate_type="0800"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:669:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:598:17
    |
 LL |     mod inner { #![crate_type="0800"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:673:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:602:5
    |
 LL |     #[crate_type = "0800"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:673:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:602:5
    |
 LL |     #[crate_type = "0800"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:677:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:606:5
    |
 LL |     #[crate_type = "0800"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:677:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:606:5
    |
 LL |     #[crate_type = "0800"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:610:5
    |
 LL |     #[crate_type = "0800"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:610:5
    |
 LL |     #[crate_type = "0800"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:614:5
    |
 LL |     #[crate_type = "0800"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:614:5
    |
 LL |     #[crate_type = "0800"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:594:1
    |
 LL | #[crate_type = "0800"]
    | ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:594:1
    |
 LL | #[crate_type = "0800"]
    | ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:17
    |
 LL |     mod inner { #![feature(x0600)] }
    |                 ^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:17
    |
 LL |     mod inner { #![feature(x0600)] }
    |                 ^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:698:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:627:5
    |
 LL |     #[feature(x0600)] fn f() { }
    |     ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:698:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:627:5
    |
 LL |     #[feature(x0600)] fn f() { }
    |     ^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:702:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:5
    |
 LL |     #[feature(x0600)] struct S;
    |     ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:702:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:5
    |
 LL |     #[feature(x0600)] struct S;
    |     ^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:5
    |
 LL |     #[feature(x0600)] type T = S;
    |     ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:5
    |
 LL |     #[feature(x0600)] type T = S;
    |     ^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5
    |
 LL |     #[feature(x0600)] impl S { }
    |     ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5
    |
 LL |     #[feature(x0600)] impl S { }
    |     ^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:619:1
    |
 LL | #[feature(x0600)]
    | ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:619:1
    |
 LL | #[feature(x0600)]
    | ^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:17
    |
 LL |     mod inner { #![no_main] }
    |                 ^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:17
    |
 LL |     mod inner { #![no_main] }
    |                 ^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:653:5
    |
 LL |     #[no_main] fn f() { }
    |     ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:653:5
    |
 LL |     #[no_main] fn f() { }
    |     ^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:657:5
    |
 LL |     #[no_main] struct S;
    |     ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:657:5
    |
 LL |     #[no_main] struct S;
    |     ^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:661:5
    |
 LL |     #[no_main] type T = S;
    |     ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:661:5
    |
 LL |     #[no_main] type T = S;
    |     ^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:5
    |
 LL |     #[no_main] impl S { }
    |     ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:5
    |
 LL |     #[no_main] impl S { }
    |     ^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:645:1
    |
 LL | #[no_main]
    | ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:645:1
    |
 LL | #[no_main]
    | ^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:17
    |
 LL |     mod inner { #![recursion_limit="0200"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:17
    |
 LL |     mod inner { #![recursion_limit="0200"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5
    |
 LL |     #[recursion_limit="0200"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5
    |
 LL |     #[recursion_limit="0200"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:5
    |
 LL |     #[recursion_limit="0200"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:5
    |
 LL |     #[recursion_limit="0200"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:5
    |
 LL |     #[recursion_limit="0200"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:5
    |
 LL |     #[recursion_limit="0200"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:5
    |
 LL |     #[recursion_limit="0200"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:5
    |
 LL |     #[recursion_limit="0200"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:1
    |
 LL | #[recursion_limit="0200"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:1
    |
 LL | #[recursion_limit="0200"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:783:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:17
    |
 LL |     mod inner { #![type_length_limit="0100"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:783:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:17
    |
 LL |     mod inner { #![type_length_limit="0100"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:787:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5
    |
 LL |     #[type_length_limit="0100"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:787:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5
    |
 LL |     #[type_length_limit="0100"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:791:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5
    |
 LL |     #[type_length_limit="0100"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:791:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5
    |
 LL |     #[type_length_limit="0100"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:795:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5
    |
 LL |     #[type_length_limit="0100"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:795:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5
    |
 LL |     #[type_length_limit="0100"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:799:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:5
    |
 LL |     #[type_length_limit="0100"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:799:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:5
    |
 LL |     #[type_length_limit="0100"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:779:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:708:1
    |
 LL | #[type_length_limit="0100"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:779:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:708:1
    |
 LL | #[type_length_limit="0100"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1234,5 +1198,5 @@ warning: unused attribute
 LL | #![proc_macro_derive()]
    | ^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: 203 warnings emitted
+warning: 197 warnings emitted
 
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs
deleted file mode 100644
index 80c602eb00a..00000000000
--- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// This is testing whether `#[inline]` signals an error or warning
-// when put in "weird" places.
-//
-// (This file sits on its own because it actually signals an error,
-// which would mess up the treatment of other cases in
-// issue-43106-gating-of-builtin-attrs.rs)
-
-// Crate-level is accepted, though it is almost certainly unused?
-#![inline]
-
-#[inline]
-//~^ ERROR attribute should be applied to function or closure
-mod inline {
-    mod inner { #![inline] }
-    //~^ ERROR attribute should be applied to function or closure
-
-    #[inline = "2100"] fn f() { }
-    //~^ ERROR attribute must be of the form
-    //~| WARN this was previously accepted
-
-    #[inline] struct S;
-    //~^ ERROR attribute should be applied to function or closure
-
-    #[inline] type T = S;
-    //~^ ERROR attribute should be applied to function or closure
-
-    #[inline] impl S { }
-    //~^ ERROR attribute should be applied to function or closure
-}
-
-fn main() {}
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr
deleted file mode 100644
index 0987937192f..00000000000
--- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr
+++ /dev/null
@@ -1,52 +0,0 @@
-error: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
-  --> $DIR/issue-43106-gating-of-inline.rs:17:5
-   |
-LL |     #[inline = "2100"] fn f() { }
-   |     ^^^^^^^^^^^^^^^^^^
-   |
-   = note: `#[deny(ill_formed_attribute_input)]` on by default
-   = warning: 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
-
-error[E0518]: attribute should be applied to function or closure
-  --> $DIR/issue-43106-gating-of-inline.rs:11:1
-   |
-LL |   #[inline]
-   |   ^^^^^^^^^
-LL |
-LL | / mod inline {
-LL | |     mod inner { #![inline] }
-LL | |
-LL | |
-...  |
-LL | |
-LL | | }
-   | |_- not a function or closure
-
-error[E0518]: attribute should be applied to function or closure
-  --> $DIR/issue-43106-gating-of-inline.rs:14:17
-   |
-LL |     mod inner { #![inline] }
-   |     ------------^^^^^^^^^^-- not a function or closure
-
-error[E0518]: attribute should be applied to function or closure
-  --> $DIR/issue-43106-gating-of-inline.rs:21:5
-   |
-LL |     #[inline] struct S;
-   |     ^^^^^^^^^ --------- not a function or closure
-
-error[E0518]: attribute should be applied to function or closure
-  --> $DIR/issue-43106-gating-of-inline.rs:24:5
-   |
-LL |     #[inline] type T = S;
-   |     ^^^^^^^^^ ----------- not a function or closure
-
-error[E0518]: attribute should be applied to function or closure
-  --> $DIR/issue-43106-gating-of-inline.rs:27:5
-   |
-LL |     #[inline] impl S { }
-   |     ^^^^^^^^^ ---------- not a function or closure
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0518`.
diff --git a/src/test/ui/issues/issue-2214.rs b/src/test/ui/issues/issue-2214.rs
index c4c56cd109d..e04eff7cc4d 100644
--- a/src/test/ui/issues/issue-2214.rs
+++ b/src/test/ui/issues/issue-2214.rs
@@ -23,7 +23,7 @@ fn lgamma(n: c_double, value: &mut isize) -> c_double {
 mod m {
     use libc::{c_double, c_int};
 
-    #[link_name = "m"]
+    #[link(name = "m")]
     extern {
         #[cfg(any(all(unix, not(target_os = "vxworks")), target_os = "cloudabi"))]
         #[link_name="lgamma_r"]
diff --git a/src/test/ui/issues/issue-47725.rs b/src/test/ui/issues/issue-47725.rs
new file mode 100644
index 00000000000..50f50ed1532
--- /dev/null
+++ b/src/test/ui/issues/issue-47725.rs
@@ -0,0 +1,22 @@
+#[link_name = "foo"] //~ ERROR attribute should be applied to a foreign function or static
+struct Foo; //~ NOTE not a foreign function or static
+
+#[link_name = "foobar"]
+//~^ ERROR attribute should be applied to a foreign function or static
+//~| HELP try `#[link(name = "foobar")]` instead
+extern "C" {
+    fn foo() -> u32;
+}
+//~^^^ NOTE not a foreign function or static
+
+#[link_name]
+//~^ ERROR malformed `link_name` attribute input
+//~| HELP must be of the form
+//~| ERROR attribute should be applied to a foreign function or static
+//~| HELP try `#[link(name = "...")]` instead
+extern "C" {
+    fn bar() -> u32;
+}
+//~^^^ NOTE not a foreign function or static
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-47725.stderr b/src/test/ui/issues/issue-47725.stderr
new file mode 100644
index 00000000000..8623317c7a0
--- /dev/null
+++ b/src/test/ui/issues/issue-47725.stderr
@@ -0,0 +1,50 @@
+error: malformed `link_name` attribute input
+  --> $DIR/issue-47725.rs:12:1
+   |
+LL | #[link_name]
+   | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-47725.rs:1:1
+   |
+LL | #[link_name = "foo"]
+   | ^^^^^^^^^^^^^^^^^^^^
+LL | struct Foo;
+   | ----------- not a foreign function or static
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-47725.rs:4:1
+   |
+LL |   #[link_name = "foobar"]
+   |   ^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | / extern "C" {
+LL | |     fn foo() -> u32;
+LL | | }
+   | |_- not a foreign function or static
+   |
+help: try `#[link(name = "foobar")]` instead
+  --> $DIR/issue-47725.rs:4:1
+   |
+LL | #[link_name = "foobar"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: attribute should be applied to a foreign function or static
+  --> $DIR/issue-47725.rs:12:1
+   |
+LL |   #[link_name]
+   |   ^^^^^^^^^^^^
+...
+LL | / extern "C" {
+LL | |     fn bar() -> u32;
+LL | | }
+   | |_- not a foreign function or static
+   |
+help: try `#[link(name = "...")]` instead
+  --> $DIR/issue-47725.rs:12:1
+   |
+LL | #[link_name]
+   | ^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/issues/issue-54044.rs b/src/test/ui/issues/issue-54044.rs
new file mode 100644
index 00000000000..eb0cf27ffbb
--- /dev/null
+++ b/src/test/ui/issues/issue-54044.rs
@@ -0,0 +1,7 @@
+#[cold] //~ ERROR attribute should be applied to a function
+struct Foo; //~ NOTE not a function
+
+fn main() {
+    #[cold] //~ ERROR attribute should be applied to a function
+    5; //~ NOTE not a function
+}
diff --git a/src/test/ui/issues/issue-54044.stderr b/src/test/ui/issues/issue-54044.stderr
new file mode 100644
index 00000000000..25616292607
--- /dev/null
+++ b/src/test/ui/issues/issue-54044.stderr
@@ -0,0 +1,18 @@
+error: attribute should be applied to a function
+  --> $DIR/issue-54044.rs:1:1
+   |
+LL | #[cold]
+   | ^^^^^^^
+LL | struct Foo;
+   | ----------- not a function
+
+error: attribute should be applied to a function
+  --> $DIR/issue-54044.rs:5:5
+   |
+LL |     #[cold]
+   |     ^^^^^^^
+LL |     5;
+   |     - not a function
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/macros/issue-68060.rs b/src/test/ui/macros/issue-68060.rs
index 8772e98b6e9..1feddc4ebd8 100644
--- a/src/test/ui/macros/issue-68060.rs
+++ b/src/test/ui/macros/issue-68060.rs
@@ -2,10 +2,11 @@ fn main() {
     (0..)
         .map(
             #[target_feature(enable = "")]
-            //~^ ERROR: the feature named `` is not valid for this target
-            //~| ERROR: `#[target_feature(..)]` can only be applied to `unsafe` functions
+            //~^ ERROR: attribute should be applied to a function
+            //~| ERROR: the feature named `` is not valid for this target
             #[track_caller]
-            //~^ ERROR: `#[track_caller]` requires Rust ABI
+            //~^ ERROR: attribute should be applied to function [E0739]
+            //~| ERROR: `#[track_caller]` requires Rust ABI [E0737]
             |_| (),
         )
         .next();
diff --git a/src/test/ui/macros/issue-68060.stderr b/src/test/ui/macros/issue-68060.stderr
index b9b2f946c59..5def8780fbf 100644
--- a/src/test/ui/macros/issue-68060.stderr
+++ b/src/test/ui/macros/issue-68060.stderr
@@ -1,14 +1,20 @@
-error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
+error: attribute should be applied to a function
   --> $DIR/issue-68060.rs:4:13
    |
 LL |             #[target_feature(enable = "")]
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ...
 LL |             |_| (),
-   |             ------ not an `unsafe` function
+   |             ------ not a function
+
+error[E0739]: attribute should be applied to function
+  --> $DIR/issue-68060.rs:7:13
    |
-   = 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
+LL |             #[track_caller]
+   |             ^^^^^^^^^^^^^^^
+...
+LL |             |_| (),
+   |             ------ not a function
 
 error: the feature named `` is not valid for this target
   --> $DIR/issue-68060.rs:4:30
@@ -17,12 +23,12 @@ LL |             #[target_feature(enable = "")]
    |                              ^^^^^^^^^^^ `` is not valid for this target
 
 error[E0737]: `#[track_caller]` requires Rust ABI
-  --> $DIR/issue-68060.rs:7:13
+  --> $DIR/issue-68060.rs:8:13
    |
 LL |             #[track_caller]
    |             ^^^^^^^^^^^^^^^
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0658, E0737.
-For more information about an error, try `rustc --explain E0658`.
+Some errors have detailed explanations: E0737, E0739.
+For more information about an error, try `rustc --explain E0737`.
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`.