about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-08-21 14:11:36 -0500
committerAaron Hill <aa1ronham@gmail.com>2021-08-21 14:11:36 -0500
commit62aea8c9134bcd66fe319010af2f9b9f39c3c887 (patch)
tree9e75990faa83da184c15b9cd1a0406776e9ccfb3
parent17aef21b30ad1534ab1372ead72a5cacea673442 (diff)
downloadrust-62aea8c9134bcd66fe319010af2f9b9f39c3c887.tar.gz
rust-62aea8c9134bcd66fe319010af2f9b9f39c3c887.zip
Address review comments
-rw-r--r--compiler/rustc_feature/src/builtin_attrs.rs2
-rw-r--r--compiler/rustc_passes/src/check_attr.rs7
-rw-r--r--src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs18
-rw-r--r--src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr969
4 files changed, 360 insertions, 636 deletions
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index 45db4c7f118..e2aa54a59b2 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -251,7 +251,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     // Modules, prelude, and resolution:
     ungated!(path, Normal, template!(NameValueStr: "file")),
     ungated!(no_std, CrateLevel, template!(Word)),
-    ungated!(no_implicit_prelude, CrateLevel, template!(Word)),
+    ungated!(no_implicit_prelude, Normal, template!(Word)),
     ungated!(non_exhaustive, Normal, template!(Word)),
 
     // Runtime
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 3009c2c3f2f..d0ddad1c1a3 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -130,6 +130,12 @@ impl CheckAttrVisitor<'tcx> {
                 sym::ignore | sym::should_panic | sym::proc_macro_derive => {
                     self.check_generic_attr(hir_id, attr, target, &[Target::Fn])
                 }
+                sym::automatically_derived => {
+                    self.check_generic_attr(hir_id, attr, target, &[Target::Impl])
+                }
+                sym::no_implicit_prelude => {
+                    self.check_generic_attr(hir_id, attr, target, &[Target::Mod])
+                }
                 _ => {}
             }
 
@@ -290,7 +296,6 @@ impl CheckAttrVisitor<'tcx> {
                 b.push_str(&(allowed_target.to_string() + "s"));
                 b
             });
-            //let supported_names = allowed_targets.iter().fold(String::new(), |msg, t| msg + ", " + &t.to_string());
             self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
                 lint.build(&format!("`#[{name}]` only has an effect on {}", supported_names))
                     .emit();
diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
index 767c521b91f..97fa775967d 100644
--- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
+++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
@@ -275,18 +275,20 @@ mod path {
     //~^ WARN `#[path]` only has an effect
 }
 
-// Don't warn on `automatically_derived` - a custom derive
-// could reasonally annotate anything that it emits with
-// this attribute
 #[automatically_derived]
+//~^ WARN `#[automatically_derived]` only has an effect
 mod automatically_derived {
     mod inner { #![automatically_derived] }
+    //~^ WARN `#[automatically_derived]
 
     #[automatically_derived] fn f() { }
+    //~^ WARN `#[automatically_derived]
 
     #[automatically_derived] struct S;
+    //~^ WARN `#[automatically_derived]
 
     #[automatically_derived] type T = S;
+    //~^ WARN `#[automatically_derived]
 
     #[automatically_derived] impl S { }
 }
@@ -368,22 +370,20 @@ mod ignore {
 }
 
 #[no_implicit_prelude]
-//~^ WARN crate-level attribute
 mod no_implicit_prelude {
     mod inner { #![no_implicit_prelude] }
-    //~^ WARN crate-level attribute
 
     #[no_implicit_prelude] fn f() { }
-    //~^ WARN crate-level attribute
+    //~^ WARN `#[no_implicit_prelude]` only has an effect
 
     #[no_implicit_prelude] struct S;
-    //~^ WARN crate-level attribute
+    //~^ WARN `#[no_implicit_prelude]` only has an effect
 
     #[no_implicit_prelude] type T = S;
-    //~^ WARN crate-level attribute
+    //~^ WARN `#[no_implicit_prelude]` only has an effect
 
     #[no_implicit_prelude] impl S { }
-    //~^ WARN crate-level attribute
+    //~^ WARN `#[no_implicit_prelude]` only has an effect
 }
 
 #[reexport_test_harness_main = "2900"]
diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
index b0fc71c8a62..214584f47e9 100644
--- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
+++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
@@ -173,7 +173,7 @@ LL |     #[deny(x5100)] impl S { }
    |            ^^^^^
 
 warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:412:17
    |
 LL |     mod inner { #![macro_escape] }
    |                 ^^^^^^^^^^^^^^^^
@@ -181,7 +181,7 @@ LL |     mod inner { #![macro_escape] }
    = help: try an outer attribute: `#[macro_use]`
 
 warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:1
    |
 LL | #[macro_escape]
    | ^^^^^^^^^^^^^^^
@@ -200,8 +200,26 @@ warning: use of deprecated attribute `no_start`: no longer used.
 LL | #![no_start]
    | ^^^^^^^^^^^^ help: remove this attribute
 
+warning: `#[macro_export]` only has an effect on macro definitions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:1
+   |
+LL | #[macro_export]
+   | ^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:39:9
+   |
+LL | #![warn(unused_attributes, unknown_lints)]
+   |         ^^^^^^^^^^^^^^^^^
+
+warning: `#[automatically_derived]` only has an effect on items
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:278:1
+   |
+LL | #[automatically_derived]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
 warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:297:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:296:1
    |
 LL |   #[no_mangle]
    |   ^^^^^^^^^^^^
@@ -215,15 +233,34 @@ LL | |     }
 LL | | }
    | |_- not a free function, impl method or static
    |
-note: the lint level is defined here
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:39:9
-   |
-LL | #![warn(unused_attributes, unknown_lints)]
-   |         ^^^^^^^^^^^^^^^^^
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
+warning: `#[should_panic]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:336:1
+   |
+LL | #[should_panic]
+   | ^^^^^^^^^^^^^^^
+
+warning: `#[ignore]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:354:1
+   |
+LL | #[ignore]
+   | ^^^^^^^^^
+
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:1
+   |
+LL | #[reexport_test_harness_main = "2900"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:1
+   |
+LL | #[no_std]
+   | ^^^^^^^^^
+
 warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:465:1
    |
 LL |   #[cold]
    |   ^^^^^^^
@@ -240,7 +277,7 @@ LL | | }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:505:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:1
    |
 LL |   #[link_name = "1900"]
    |   ^^^^^^^^^^^^^^^^^^^^^
@@ -257,7 +294,7 @@ LL | | }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:544:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:533:1
    |
 LL |   #[link_section = "1800"]
    |   ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -273,1015 +310,697 @@ LL | | }
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:61:1
-   |
-LL | #![cold]
-   | ^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:624:1
    |
-LL | #![link_name = "1900"]
+LL | #[crate_name = "0900"]
    | ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1
-   |
-LL | #![link_section = "1800"]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:302:17
-   |
-LL |     mod inner { #![no_mangle] }
-   |     ------------^^^^^^^^^^^^^-- not a free function, impl method or static
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:309:5
-   |
-LL |     #[no_mangle] struct S;
-   |     ^^^^^^^^^^^^ --------- not a free function, impl method or static
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:1
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+LL | #[crate_type = "0800"]
+   | ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:314:5
-   |
-LL |     #[no_mangle] type T = S;
-   |     ^^^^^^^^^^^^ ----------- not a free function, impl method or static
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:662:1
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+LL | #[feature(x0600)]
+   | ^^^^^^^^^^^^^^^^^
 
-warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:319:5
-   |
-LL |     #[no_mangle] impl S { }
-   |     ^^^^^^^^^^^^ ---------- not a free function, impl method or static
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:1
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+LL | #[no_main]
+   | ^^^^^^^^^^
 
-warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:325:9
-   |
-LL |         #[no_mangle] fn foo();
-   |         ^^^^^^^^^^^^ --------- not a free function, impl method or static
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:1
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+LL | #[recursion_limit="0200"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:330:9
-   |
-LL |         #[no_mangle] fn bar() {}
-   |         ^^^^^^^^^^^^ ----------- not a free function, impl method or static
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:733:1
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+LL | #[type_length_limit="0100"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:482:17
-   |
-LL |     mod inner { #![cold] }
-   |     ------------^^^^^^^^-- not a function
+warning: `#[should_panic]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:1
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+LL | #![should_panic]
+   | ^^^^^^^^^^^^^^^^
 
-warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:5
-   |
-LL |     #[cold] struct S;
-   |     ^^^^^^^ --------- not a function
+warning: `#[ignore]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+LL | #![ignore]
+   | ^^^^^^^^^^
 
-warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:5
-   |
-LL |     #[cold] type T = S;
-   |     ^^^^^^^ ----------- not a function
+warning: `#[proc_macro_derive]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+LL | #![proc_macro_derive()]
+   | ^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5
-   |
-LL |     #[cold] impl S { }
-   |     ^^^^^^^ ---------- not a function
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:511:5
-   |
-LL |     #[link_name = "1900"]
-   |     ^^^^^^^^^^^^^^^^^^^^^
-...
-LL |     extern "C" { }
-   |     -------------- not a foreign function or static
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-help: try `#[link(name = "1900")]` instead
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:511:5
-   |
-LL |     #[link_name = "1900"]
-   |     ^^^^^^^^^^^^^^^^^^^^^
-
-warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:518:17
-   |
-LL |     mod inner { #![link_name="1900"] }
-   |     ------------^^^^^^^^^^^^^^^^^^^^-- not a foreign function or static
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:5
-   |
-LL |     #[link_name = "1900"] fn f() { }
-   |     ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:528:5
-   |
-LL |     #[link_name = "1900"] struct S;
-   |     ^^^^^^^^^^^^^^^^^^^^^ --------- not a foreign function or static
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:533:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:61:1
    |
-LL |     #[link_name = "1900"] type T = S;
-   |     ^^^^^^^^^^^^^^^^^^^^^ ----------- not a foreign function or static
+LL | #![cold]
+   | ^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:538:5
-   |
-LL |     #[link_name = "1900"] impl S { }
-   |     ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:550:17
-   |
-LL |     mod inner { #![link_section="1800"] }
-   |     ------------^^^^^^^^^^^^^^^^^^^^^^^-- not a function or static
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:557:5
-   |
-LL |     #[link_section = "1800"] struct S;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ --------- not a function or static
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-
-warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:562:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1
    |
-LL |     #[link_section = "1800"] type T = S;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a function or static
+LL | #![link_name = "1900"]
+   | ^^^^^^^^^^^^^^^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:567:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1
    |
-LL |     #[link_section = "1800"] impl S { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a function or static
+LL | #![link_section = "1800"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:89:12
-   |
-LL | #![feature(rust1)]
-   |            ^^^^^
-   |
-   = note: `#[warn(stable_features)]` on by default
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:1
-   |
-LL | #![should_panic]
-   | ^^^^^^^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1
-   |
-LL | #![ignore]
-   | ^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1
-   |
-LL | #![proc_macro_derive()]
-   | ^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: unused attribute
+warning: `#[macro_use]` only has an effect on `extern crate` and modules
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:5
    |
 LL |     #[macro_use] fn f() { }
    |     ^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[macro_use]` only has an effect on `extern crate` and modules
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:187:5
    |
 LL |     #[macro_use] struct S;
    |     ^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[macro_use]` only has an effect on `extern crate` and modules
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:190:5
    |
 LL |     #[macro_use] type T = S;
    |     ^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[macro_use]` only has an effect on `extern crate` and modules
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:193:5
    |
 LL |     #[macro_use] impl S { }
    |     ^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:1
-   |
-LL | #[macro_export]
-   | ^^^^^^^^^^^^^^^
-
-warning: unused attribute
+warning: `#[macro_export]` only has an effect on macro definitions
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:200:17
    |
 LL |     mod inner { #![macro_export] }
    |                 ^^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[macro_export]` only has an effect on macro definitions
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:203:5
    |
 LL |     #[macro_export] fn f() { }
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[macro_export]` only has an effect on macro definitions
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:206:5
    |
 LL |     #[macro_export] struct S;
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[macro_export]` only has an effect on macro definitions
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:209:5
    |
 LL |     #[macro_export] type T = S;
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[macro_export]` only has an effect on macro definitions
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:212:5
    |
 LL |     #[macro_export] impl S { }
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[path]` only has an effect on modules
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:265:5
    |
 LL |     #[path = "3800"] fn f() { }
    |     ^^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[path]` only has an effect on modules
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:268:5
    |
 LL |     #[path = "3800"]  struct S;
    |     ^^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[path]` only has an effect on modules
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5
    |
 LL |     #[path = "3800"] type T = S;
    |     ^^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[path]` only has an effect on modules
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5
    |
 LL |     #[path = "3800"] impl S { }
    |     ^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:278:1
-   |
-LL | #[automatically_derived]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: unused attribute
+warning: `#[automatically_derived]` only has an effect on items
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:281:17
    |
 LL |     mod inner { #![automatically_derived] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[automatically_derived]` only has an effect on items
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:284:5
    |
 LL |     #[automatically_derived] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[automatically_derived]` only has an effect on items
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:287:5
    |
 LL |     #[automatically_derived] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[automatically_derived]` only has an effect on items
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:290:5
    |
 LL |     #[automatically_derived] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:293:5
+warning: attribute should be applied to a free function, impl method or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:301:17
    |
-LL |     #[automatically_derived] impl S { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     mod inner { #![no_mangle] }
+   |     ------------^^^^^^^^^^^^^-- not a free function, impl method or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:337:1
+warning: attribute should be applied to a free function, impl method or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:5
    |
-LL | #[should_panic]
-   | ^^^^^^^^^^^^^^^
+LL |     #[no_mangle] struct S;
+   |     ^^^^^^^^^^^^ --------- not a free function, impl method or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:340:17
+warning: attribute should be applied to a free function, impl method or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:313:5
    |
-LL |     mod inner { #![should_panic] }
-   |                 ^^^^^^^^^^^^^^^^
+LL |     #[no_mangle] type T = S;
+   |     ^^^^^^^^^^^^ ----------- not a free function, impl method or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:343:5
+warning: attribute should be applied to a free function, impl method or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:318:5
    |
-LL |     #[should_panic] fn f() { }
-   |     ^^^^^^^^^^^^^^^
+LL |     #[no_mangle] impl S { }
+   |     ^^^^^^^^^^^^ ---------- not a free function, impl method or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+warning: attribute should be applied to a free function, impl method or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:324:9
+   |
+LL |         #[no_mangle] fn foo();
+   |         ^^^^^^^^^^^^ --------- not a free function, impl method or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+warning: attribute should be applied to a free function, impl method or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:9
+   |
+LL |         #[no_mangle] fn bar() {}
+   |         ^^^^^^^^^^^^ ----------- not a free function, impl method or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+warning: `#[should_panic]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:339:17
+   |
+LL |     mod inner { #![should_panic] }
+   |                 ^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:346:5
+warning: `#[should_panic]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:5
    |
 LL |     #[should_panic] struct S;
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:5
+warning: `#[should_panic]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:347:5
    |
 LL |     #[should_panic] type T = S;
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:352:5
+warning: `#[should_panic]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:350:5
    |
 LL |     #[should_panic] impl S { }
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:356:1
-   |
-LL | #[ignore]
-   | ^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:359:17
+warning: `#[ignore]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:357:17
    |
 LL |     mod inner { #![ignore] }
    |                 ^^^^^^^^^^
 
-warning: unused attribute
+warning: `#[ignore]` only has an effect on functions
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:5
    |
-LL |     #[ignore] fn f() { }
-   |     ^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:5
-   |
 LL |     #[ignore] struct S;
    |     ^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:5
+warning: `#[ignore]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:5
    |
 LL |     #[ignore] type T = S;
    |     ^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:371:5
+warning: `#[ignore]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:5
    |
 LL |     #[ignore] impl S { }
    |     ^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:375:1
-   |
-LL | #[no_implicit_prelude]
-   | ^^^^^^^^^^^^^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:378:17
-   |
-LL |     mod inner { #![no_implicit_prelude] }
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:381:5
+warning: `#[no_implicit_prelude]` only has an effect on modules
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5
    |
 LL |     #[no_implicit_prelude] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:384:5
+warning: `#[no_implicit_prelude]` only has an effect on modules
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:5
    |
 LL |     #[no_implicit_prelude] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:387:5
+warning: `#[no_implicit_prelude]` only has an effect on modules
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:5
    |
 LL |     #[no_implicit_prelude] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:390:5
+warning: `#[no_implicit_prelude]` only has an effect on modules
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:385:5
    |
 LL |     #[no_implicit_prelude] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:394:1
-   |
-LL | #[reexport_test_harness_main = "2900"]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:397:17
+warning: crate-level attribute should be in the root module
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:17
    |
 LL |     mod inner { #![reexport_test_harness_main="2900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:400:5
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5
    |
 LL |     #[reexport_test_harness_main = "2900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:403:5
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5
    |
 LL |     #[reexport_test_harness_main = "2900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:406:5
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:5
    |
 LL |     #[reexport_test_harness_main = "2900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:5
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:5
    |
 LL |     #[reexport_test_harness_main = "2900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:421:5
+warning: `#[macro_escape]` only has an effect on `extern crate` and modules
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:5
    |
 LL |     #[macro_escape] fn f() { }
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:424:5
+warning: `#[macro_escape]` only has an effect on `extern crate` and modules
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:5
    |
 LL |     #[macro_escape] struct S;
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:5
+warning: `#[macro_escape]` only has an effect on `extern crate` and modules
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:422:5
    |
 LL |     #[macro_escape] type T = S;
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:5
+warning: `#[macro_escape]` only has an effect on `extern crate` and modules
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:425:5
    |
 LL |     #[macro_escape] impl S { }
    |     ^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:434: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:434:1
-   |
-LL | #[no_std]
-   | ^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:17
-   |
-LL |     mod inner { #![no_std] }
-   |                 ^^^^^^^^^^
-
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:17
    |
 LL |     mod inner { #![no_std] }
    |                 ^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442: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:442:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5
    |
 LL |     #[no_std] fn f() { }
    |     ^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446: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:446:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:5
    |
 LL |     #[no_std] struct S;
    |     ^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:450: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:450:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:441:5
    |
 LL |     #[no_std] type T = S;
    |     ^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:454: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:454:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:444:5
    |
 LL |     #[no_std] impl S { }
    |     ^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:1
+warning: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:17
    |
-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:635:1
+LL |     mod inner { #![cold] }
+   |     ------------^^^^^^^^-- not a function
    |
-LL | #[crate_name = "0900"]
-   | ^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:17
+warning: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:5
    |
-LL |     mod inner { #![crate_name="0900"] }
-   |                 ^^^^^^^^^^^^^^^^^^^^^
+LL |     #[cold] struct S;
+   |     ^^^^^^^ --------- not a function
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:17
+warning: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:5
    |
-LL |     mod inner { #![crate_name="0900"] }
-   |                 ^^^^^^^^^^^^^^^^^^^^^
+LL |     #[cold] type T = S;
+   |     ^^^^^^^ ----------- not a function
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5
+warning: attribute should be applied to a function
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5
    |
-LL |     #[crate_name = "0900"] fn f() { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[cold] impl S { }
+   |     ^^^^^^^ ---------- not a function
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5
+warning: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:5
    |
-LL |     #[crate_name = "0900"] fn f() { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[link_name = "1900"]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+...
+LL |     extern "C" { }
+   |     -------------- not a foreign function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+help: try `#[link(name = "1900")]` instead
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:5
+   |
+LL |     #[link_name = "1900"]
+   |     ^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5
+warning: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:507:17
    |
-LL |     #[crate_name = "0900"] struct S;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     mod inner { #![link_name="1900"] }
+   |     ------------^^^^^^^^^^^^^^^^^^^^-- not a foreign function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5
+warning: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:5
    |
-LL |     #[crate_name = "0900"] struct S;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[link_name = "1900"] fn f() { }
+   |     ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5
+warning: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:517:5
    |
-LL |     #[crate_name = "0900"] type T = S;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[link_name = "1900"] struct S;
+   |     ^^^^^^^^^^^^^^^^^^^^^ --------- not a foreign function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5
+warning: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:522:5
    |
-LL |     #[crate_name = "0900"] type T = S;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[link_name = "1900"] type T = S;
+   |     ^^^^^^^^^^^^^^^^^^^^^ ----------- not a foreign function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5
+warning: attribute should be applied to a foreign function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5
    |
-LL |     #[crate_name = "0900"] impl S { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[link_name = "1900"] impl S { }
+   |     ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5
+warning: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:17
    |
-LL |     #[crate_name = "0900"] impl S { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     mod inner { #![link_section="1800"] }
+   |     ------------^^^^^^^^^^^^^^^^^^^^^^^-- not a function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:1
+warning: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:546:5
    |
-LL | #[crate_type = "0800"]
-   | ^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[link_section = "1800"] struct S;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ --------- not a function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:1
+warning: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:551:5
    |
-LL | #[crate_type = "0800"]
-   | ^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[link_section = "1800"] type T = S;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:17
+warning: attribute should be applied to a function or static
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:556:5
    |
-LL |     mod inner { #![crate_type="0800"] }
-   |                 ^^^^^^^^^^^^^^^^^^^^^
+LL |     #[link_section = "1800"] impl S { }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a function or static
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:627:17
    |
-LL |     mod inner { #![crate_type="0800"] }
+LL |     mod inner { #![crate_name="0900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:5
    |
-LL |     #[crate_type = "0800"] fn f() { }
+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:668:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:5
    |
-LL |     #[crate_type = "0800"] fn f() { }
+LL |     #[crate_name = "0900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5
    |
-LL |     #[crate_type = "0800"] struct S;
+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:672:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5
    |
-LL |     #[crate_type = "0800"] struct S;
+LL |     #[crate_name = "0900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5
+warning: crate-level attribute should be in the root module
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:17
    |
-LL |     #[crate_type = "0800"] type T = S;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+LL |     mod inner { #![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:676:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:5
    |
-LL |     #[crate_type = "0800"] type T = S;
+LL |     #[crate_type = "0800"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:680:5
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:5
    |
-LL |     #[crate_type = "0800"] impl S { }
+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:680:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5
    |
-LL |     #[crate_type = "0800"] impl S { }
+LL |     #[crate_type = "0800"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685: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:685:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:5
    |
-LL | #[feature(x0600)]
-   | ^^^^^^^^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:17
-   |
-LL |     mod inner { #![feature(x0600)] }
-   |                 ^^^^^^^^^^^^^^^^^^
+LL |     #[crate_type = "0800"] impl S { }
+   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:17
    |
 LL |     mod inner { #![feature(x0600)] }
    |                 ^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693: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:693:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5
    |
 LL |     #[feature(x0600)] fn f() { }
    |     ^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697: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:697:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:5
    |
 LL |     #[feature(x0600)] struct S;
    |     ^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701: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:701:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:5
    |
 LL |     #[feature(x0600)] type T = S;
    |     ^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:705: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:705:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:677:5
    |
 LL |     #[feature(x0600)] impl S { }
    |     ^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711: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:711:1
-   |
-LL | #[no_main]
-   | ^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:17
-   |
-LL |     mod inner { #![no_main] }
-   |                 ^^^^^^^^^^^
-
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17
    |
 LL |     mod inner { #![no_main] }
    |                 ^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719: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:719:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:5
    |
 LL |     #[no_main] fn f() { }
    |     ^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723: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:723:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5
    |
 LL |     #[no_main] struct S;
    |     ^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727: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:727:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5
    |
 LL |     #[no_main] type T = S;
    |     ^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:731: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:731:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5
    |
 LL |     #[no_main] impl S { }
    |     ^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749: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:749:1
-   |
-LL | #[recursion_limit="0200"]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753: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:753:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:717:17
    |
 LL |     mod inner { #![recursion_limit="0200"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757: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:757:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5
    |
 LL |     #[recursion_limit="0200"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761: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:761:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5
    |
 LL |     #[recursion_limit="0200"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765: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:765:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5
    |
 LL |     #[recursion_limit="0200"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:769: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:769:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:5
    |
 LL |     #[recursion_limit="0200"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774: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:774:1
-   |
-LL | #[type_length_limit="0100"]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778: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:778:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:17
    |
 LL |     mod inner { #![type_length_limit="0100"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782: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:782:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:739:5
    |
 LL |     #[type_length_limit="0100"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786: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:786:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:742:5
    |
 LL |     #[type_length_limit="0100"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790: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:790:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:5
    |
 LL |     #[type_length_limit="0100"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:794:5
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748: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:794:5
+warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:89:12
    |
-LL |     #[type_length_limit="0100"] impl S { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(rust1)]
+   |            ^^^^^
+   |
+   = note: `#[warn(stable_features)]` on by default
 
-warning: 195 warnings emitted
+warning: 148 warnings emitted