+//~ NOTE not a function
+//~^ NOTE not a foreign function or static
+//~^^ NOTE not a function or static
// This test enumerates as many compiler-builtin ungated attributes as
// possible (that is, all the mutually compatible ones), and checks
// that we get "expected" (*) warnings for each in the various weird
// occurrences in the source text.
// check-pass
+// ignore-tidy-linelength
#![feature(test, plugin_registrar)]
#![warn(unused_attributes, unknown_lints)]
+//~^ NOTE the lint level is defined here
+//~| NOTE the lint level is defined here
// Exception, a gated and deprecated attribute.
-#![plugin_registrar] //~ WARN unused attribute
+#![plugin_registrar]
+//~^ WARN unused attribute
//~| WARN use of deprecated attribute
+//~| HELP may be removed in a future compiler version
// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES
#![forbid(x5200)] //~ WARN unknown lint: `x5200`
#![deny(x5100)] //~ WARN unknown lint: `x5100`
#![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs)
-#![macro_export] //~ WARN unused attribute
// skipping testing of cfg
// skipping testing of cfg_attr
-#![main] //~ WARN unused attribute
-#![start] //~ WARN unused attribute
-// see issue-43106-gating-of-test.rs for crate-level; but non crate-level is below at "4200"
-// see issue-43106-gating-of-bench.rs for crate-level; but non crate-level is below at "4100"
-#![repr()]
-//~^ WARN unused attribute
-#![path = "3800"] //~ WARN unused attribute
-#![automatically_derived] //~ WARN unused attribute
-#![no_mangle]
-#![no_link] //~ WARN unused attribute
-// see issue-43106-gating-of-derive.rs
#![should_panic] //~ WARN unused attribute
#![ignore] //~ WARN unused attribute
#![no_implicit_prelude]
// (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600")
#![proc_macro_derive()] //~ WARN unused attribute
#![doc = "2400"]
-#![cold]
-#![export_name = "2200"]
-// see issue-43106-gating-of-inline.rs
+#![cold] //~ WARN attribute should be applied to a function
+//~^ WARN
+// see issue-43106-gating-of-builtin-attrs-error.rs
#![link()]
#![link_name = "1900"]
+//~^ WARN attribute should be applied to a foreign function
+//~^^ WARN this was previously accepted by the compiler
#![link_section = "1800"]
+//~^ WARN attribute should be applied to a function or static
+//~^^ WARN this was previously accepted by the compiler
// see issue-43106-gating-of-rustc_deprecated.rs
#![must_use]
// see issue-43106-gating-of-stable.rs
#![crate_name = "0900"]
#![crate_type = "bin"] // cannot pass "0800" here
-#![crate_id = "10"] //~ WARN use of deprecated attribute
+#![crate_id = "10"]
+//~^ WARN use of deprecated attribute
+//~| HELP remove this attribute
// FIXME(#44232) we should warn that this isn't used.
-#![feature(rust1)] //~ WARN no longer requires an attribute to enable
+#![feature(rust1)]
+//~^ WARN no longer requires an attribute to enable
+//~| NOTE `#[warn(stable_features)]` on by default
-#![no_start] //~ WARN use of deprecated attribute
+#![no_start]
+//~^ WARN use of deprecated attribute
+//~| HELP remove this attribute
// (cannot easily gating state of crate-level #[no_main]; but non crate-level is below at "0400")
#![no_builtins]
#[plugin_registrar]
//~^ WARN unused attribute
//~| WARN use of deprecated attribute
+//~| HELP may be removed in a future compiler version
mod plugin_registrar {
mod inner { #![plugin_registrar] }
//~^ WARN unused attribute
//~| WARN use of deprecated attribute
+ //~| HELP may be removed in a future compiler version
+ //~| NOTE `#[warn(deprecated)]` on by default
// for `fn f()` case, see gated-plugin_registrar.rs
#[plugin_registrar] struct S;
//~^ WARN unused attribute
//~| WARN use of deprecated attribute
+ //~| HELP may be removed in a future compiler version
#[plugin_registrar] type T = S;
//~^ WARN unused attribute
//~| WARN use of deprecated attribute
+ //~| HELP may be removed in a future compiler version
#[plugin_registrar] impl S { }
//~^ WARN unused attribute
//~| WARN use of deprecated attribute
-}
-
-#[main]
-//~^ WARN unused attribute
-mod main {
- mod inner { #![main] }
- //~^ WARN unused attribute
-
- // for `fn f()` case, see feature-gate-main.rs
-
- #[main] struct S;
- //~^ WARN unused attribute
-
- #[main] type T = S;
- //~^ WARN unused attribute
-
- #[main] impl S { }
- //~^ WARN unused attribute
-}
-
-#[start]
-//~^ WARN unused attribute
-mod start {
- mod inner { #![start] }
- //~^ WARN unused attribute
-
- // for `fn f()` case, see feature-gate-start.rs
-
- #[start] struct S;
- //~^ WARN unused attribute
-
- #[start] type T = S;
- //~^ WARN unused attribute
-
- #[start] impl S { }
- //~^ WARN unused attribute
+ //~| HELP may be removed in a future compiler version
}
// At time of unit test authorship, if compiling without `--test` then
}
#[no_mangle]
+//~^ WARN attribute should be applied to a function or static [unused_attributes]
+//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
mod no_mangle {
+ //~^ NOTE not a function or static
mod inner { #![no_mangle] }
+ //~^ WARN attribute should be applied to a function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function or static
#[no_mangle] fn f() { }
#[no_mangle] struct S;
+ //~^ WARN attribute should be applied to a function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function or static
#[no_mangle] type T = S;
+ //~^ WARN attribute should be applied to a function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function or static
#[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
+ //~^ WARN attribute should be applied to a function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function or static
}
#[should_panic]
mod macro_escape {
mod inner { #![macro_escape] }
//~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
+ //~| HELP try an outer attribute: `#[macro_use]`
#[macro_escape] fn f() { }
//~^ WARN unused attribute
}
#[cold]
+//~^ WARN attribute should be applied to a function
+//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
mod cold {
+ //~^ NOTE not a function
+
mod inner { #![cold] }
+ //~^ WARN attribute should be applied to a function
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function
#[cold] fn f() { }
#[cold] struct S;
+ //~^ WARN attribute should be applied to a function
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function
#[cold] type T = S;
+ //~^ WARN attribute should be applied to a function
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function
#[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
-// whether they have the same effect here as at crate-level).
-
-#[link()]
-mod link {
- mod inner { #![link()] }
-
- #[link()] fn f() { }
-
- #[link()] struct S;
-
- #[link()] type T = S;
-
- #[link()] impl S { }
+ //~^ WARN attribute should be applied to a function
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function
}
#[link_name = "1900"]
+//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
+//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
mod link_name {
+ //~^ NOTE not a foreign function or static
+
+ #[link_name = "1900"]
+ //~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
+ //~| WARN 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
+ extern { }
+ //~^ NOTE not a foreign function or static
+
mod inner { #![link_name="1900"] }
+ //~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a foreign function or static
#[link_name = "1900"] fn f() { }
+ //~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a foreign function or static
#[link_name = "1900"] struct S;
+ //~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a foreign function or static
#[link_name = "1900"] type T = S;
+ //~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a foreign function or static
#[link_name = "1900"] impl S { }
+ //~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a foreign function or static
}
#[link_section = "1800"]
+//~^ WARN attribute should be applied to a function or static [unused_attributes]
+//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
mod link_section {
+ //~^ NOTE not a function or static
+
mod inner { #![link_section="1800"] }
+ //~^ WARN attribute should be applied to a function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function or static
#[link_section = "1800"] fn f() { }
#[link_section = "1800"] struct S;
+ //~^ WARN attribute should be applied to a function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function or static
#[link_section = "1800"] type T = S;
+ //~^ WARN attribute should be applied to a function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function or static
#[link_section = "1800"] impl S { }
+ //~^ WARN attribute should be applied to a function or static [unused_attributes]
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| NOTE not a function or static
+}
+
+
+// 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
+// whether they have the same effect here as at crate-level).
+
+#[link()]
+mod link {
+ mod inner { #![link()] }
+
+ #[link()] fn f() { }
+
+ #[link()] struct S;
+
+ #[link()] type T = S;
+
+ #[link()] impl S { }
}
struct StructForDeprecated;