Remove Session.used_attrs and move logic to CheckAttrVisitor
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
This commit is contained in:
parent
b6e334d873
commit
af46699f81
62 changed files with 535 additions and 739 deletions
|
|
@ -4,7 +4,5 @@
|
|||
#![feature(register_tool)]
|
||||
|
||||
#[register_attr(attr)] //~ ERROR crate-level attribute should be an inner attribute
|
||||
//~| ERROR unused attribute
|
||||
#[register_tool(tool)] //~ ERROR crate-level attribute should be an inner attribute
|
||||
//~| ERROR unused attribute
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: unused attribute
|
||||
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
|
||||
--> $DIR/register-attr-tool-unused.rs:6:1
|
||||
|
|
||||
LL | #[register_attr(attr)]
|
||||
|
|
@ -12,22 +12,10 @@ LL | #![deny(unused)]
|
|||
= note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]`
|
||||
|
||||
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
|
||||
--> $DIR/register-attr-tool-unused.rs:6:1
|
||||
|
|
||||
LL | #[register_attr(attr)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/register-attr-tool-unused.rs:8:1
|
||||
--> $DIR/register-attr-tool-unused.rs:7:1
|
||||
|
|
||||
LL | #[register_tool(tool)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
|
||||
--> $DIR/register-attr-tool-unused.rs:8:1
|
||||
|
|
||||
LL | #[register_tool(tool)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
#![deny(unused)]
|
||||
|
||||
#[cfg_attr(FALSE,)] //~ ERROR unused attribute
|
||||
#[cfg_attr(FALSE,)] //~ ERROR `#[cfg_attr]` does not expand to any attributes
|
||||
fn _f() {}
|
||||
|
||||
#[cfg_attr(TRUE,)] //~ ERROR unused attribute
|
||||
#[cfg_attr(TRUE,)] //~ ERROR `#[cfg_attr]` does not expand to any attributes
|
||||
fn _g() {}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: unused attribute
|
||||
error: `#[cfg_attr]` does not expand to any attributes
|
||||
--> $DIR/cfg-attr-empty-is-unused.rs:7:1
|
||||
|
|
||||
LL | #[cfg_attr(FALSE,)]
|
||||
|
|
@ -11,7 +11,7 @@ LL | #![deny(unused)]
|
|||
| ^^^^^^
|
||||
= note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]`
|
||||
|
||||
error: unused attribute
|
||||
error: `#[cfg_attr]` does not expand to any attributes
|
||||
--> $DIR/cfg-attr-empty-is-unused.rs:10:1
|
||||
|
|
||||
LL | #[cfg_attr(TRUE,)]
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ pub struct ConstDefaultUnstable<const N: usize = 3>;
|
|||
|
||||
#[stable(feature = "const_default_unstable", since="none")]
|
||||
pub struct ConstDefaultStable<const N: usize = {
|
||||
#[stable(feature = "const_default_unstable_val", since="none")]
|
||||
3
|
||||
}>;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,14 +49,14 @@
|
|||
#![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs)
|
||||
// skipping testing of cfg
|
||||
// skipping testing of cfg_attr
|
||||
#![should_panic] //~ WARN unused attribute
|
||||
#![ignore] //~ WARN unused attribute
|
||||
#![should_panic] //~ WARN `#[should_panic]` only has an effect
|
||||
#![ignore] //~ WARN `#[ignore]` only has an effect on functions
|
||||
#![no_implicit_prelude]
|
||||
#![reexport_test_harness_main = "2900"]
|
||||
// see gated-link-args.rs
|
||||
// see issue-43106-gating-of-macro_escape.rs for crate-level; but non crate-level is below at "2700"
|
||||
// (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600")
|
||||
#![proc_macro_derive()] //~ WARN unused attribute
|
||||
#![proc_macro_derive()] //~ WARN `#[proc_macro_derive]` only has an effect
|
||||
#![doc = "2400"]
|
||||
#![cold] //~ WARN attribute should be applied to a function
|
||||
//~^ WARN
|
||||
|
|
@ -182,35 +182,35 @@ mod macro_use {
|
|||
mod inner { #![macro_use] }
|
||||
|
||||
#[macro_use] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ `#[macro_use]` only has an effect
|
||||
|
||||
#[macro_use] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ `#[macro_use]` only has an effect
|
||||
|
||||
#[macro_use] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ `#[macro_use]` only has an effect
|
||||
|
||||
#[macro_use] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ `#[macro_use]` only has an effect
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_export]` only has an effect on macro definitions
|
||||
mod macro_export {
|
||||
mod inner { #![macro_export] }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_export]` only has an effect on macro definitions
|
||||
|
||||
#[macro_export] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_export]` only has an effect on macro definitions
|
||||
|
||||
#[macro_export] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_export]` only has an effect on macro definitions
|
||||
|
||||
#[macro_export] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_export]` only has an effect on macro definitions
|
||||
|
||||
#[macro_export] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_export]` only has an effect on macro definitions
|
||||
}
|
||||
|
||||
// At time of unit test authorship, if compiling without `--test` then
|
||||
|
|
@ -263,35 +263,32 @@ mod path {
|
|||
mod inner { #![path="3800"] }
|
||||
|
||||
#[path = "3800"] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[path]` only has an effect
|
||||
|
||||
#[path = "3800"] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[path]` only has an effect
|
||||
|
||||
#[path = "3800"] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[path]` only has an effect
|
||||
|
||||
#[path = "3800"] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ 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 unused attribute
|
||||
mod automatically_derived {
|
||||
mod inner { #![automatically_derived] }
|
||||
//~^ WARN unused attribute
|
||||
|
||||
#[automatically_derived] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
|
||||
#[automatically_derived] struct S;
|
||||
//~^ WARN unused attribute
|
||||
|
||||
#[automatically_derived] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
|
||||
#[automatically_derived] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
@ -335,79 +332,77 @@ mod no_mangle {
|
|||
}
|
||||
|
||||
#[should_panic]
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[should_panic]` only has an effect on
|
||||
mod should_panic {
|
||||
mod inner { #![should_panic] }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[should_panic]` only has an effect on
|
||||
|
||||
#[should_panic] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
|
||||
#[should_panic] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[should_panic]` only has an effect on
|
||||
|
||||
#[should_panic] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[should_panic]` only has an effect on
|
||||
|
||||
#[should_panic] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[should_panic]` only has an effect on
|
||||
}
|
||||
|
||||
#[ignore]
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[ignore]` only has an effect on functions
|
||||
mod ignore {
|
||||
mod inner { #![ignore] }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[ignore]` only has an effect on functions
|
||||
|
||||
#[ignore] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
|
||||
#[ignore] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[ignore]` only has an effect on functions
|
||||
|
||||
#[ignore] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[ignore]` only has an effect on functions
|
||||
|
||||
#[ignore] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[ignore]` only has an effect on functions
|
||||
}
|
||||
|
||||
#[no_implicit_prelude]
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute
|
||||
mod no_implicit_prelude {
|
||||
mod inner { #![no_implicit_prelude] }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute
|
||||
|
||||
#[no_implicit_prelude] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute
|
||||
|
||||
#[no_implicit_prelude] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute
|
||||
|
||||
#[no_implicit_prelude] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute
|
||||
|
||||
#[no_implicit_prelude] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute
|
||||
}
|
||||
|
||||
#[reexport_test_harness_main = "2900"]
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute should be
|
||||
mod reexport_test_harness_main {
|
||||
mod inner { #![reexport_test_harness_main="2900"] }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute should be
|
||||
|
||||
#[reexport_test_harness_main = "2900"] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute should be
|
||||
|
||||
#[reexport_test_harness_main = "2900"] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute should be
|
||||
|
||||
#[reexport_test_harness_main = "2900"] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute should be
|
||||
|
||||
#[reexport_test_harness_main = "2900"] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN crate-level attribute should be
|
||||
}
|
||||
|
||||
// Cannot feed "2700" to `#[macro_escape]` without signaling an error.
|
||||
|
|
@ -419,41 +414,35 @@ mod macro_escape {
|
|||
//~| HELP try an outer attribute: `#[macro_use]`
|
||||
|
||||
#[macro_escape] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_escape]` only has an effect
|
||||
|
||||
#[macro_escape] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_escape]` only has an effect
|
||||
|
||||
#[macro_escape] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_escape]` only has an effect
|
||||
|
||||
#[macro_escape] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~^ WARN `#[macro_escape]` only has an effect
|
||||
}
|
||||
|
||||
#[no_std]
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
mod no_std {
|
||||
mod inner { #![no_std] }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be in the root module
|
||||
//~^ WARN crate-level attribute should be in the root module
|
||||
|
||||
#[no_std] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[no_std] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[no_std] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[no_std] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
}
|
||||
|
||||
// At time of authorship, #[proc_macro_derive = "2500"] signals error
|
||||
|
|
@ -633,104 +622,80 @@ mod windows_subsystem {
|
|||
// BROKEN USES OF CRATE-LEVEL BUILT-IN ATTRIBUTES
|
||||
|
||||
#[crate_name = "0900"]
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
mod crate_name {
|
||||
mod inner { #![crate_name="0900"] }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be in the root module
|
||||
//~^ WARN crate-level attribute should be in the root module
|
||||
|
||||
#[crate_name = "0900"] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[crate_name = "0900"] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[crate_name = "0900"] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[crate_name = "0900"] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
}
|
||||
|
||||
#[crate_type = "0800"]
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
mod crate_type {
|
||||
mod inner { #![crate_type="0800"] }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be in the root module
|
||||
//~^ WARN crate-level attribute should be in the root module
|
||||
|
||||
#[crate_type = "0800"] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[crate_type = "0800"] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[crate_type = "0800"] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[crate_type = "0800"] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
}
|
||||
|
||||
#[feature(x0600)]
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
mod feature {
|
||||
mod inner { #![feature(x0600)] }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be in the root module
|
||||
//~^ WARN crate-level attribute should be in the root module
|
||||
|
||||
#[feature(x0600)] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[feature(x0600)] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[feature(x0600)] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[feature(x0600)] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
}
|
||||
|
||||
|
||||
#[no_main]
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
mod no_main_1 {
|
||||
mod inner { #![no_main] }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be in the root module
|
||||
//~^ WARN crate-level attribute should be in the root module
|
||||
|
||||
#[no_main] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[no_main] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[no_main] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[no_main] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
}
|
||||
|
||||
#[no_builtins]
|
||||
|
|
@ -747,53 +712,41 @@ mod no_builtins {
|
|||
}
|
||||
|
||||
#[recursion_limit="0200"]
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
mod recursion_limit {
|
||||
mod inner { #![recursion_limit="0200"] }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be in the root module
|
||||
//~^ WARN crate-level attribute should be in the root module
|
||||
|
||||
#[recursion_limit="0200"] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[recursion_limit="0200"] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[recursion_limit="0200"] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[recursion_limit="0200"] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
}
|
||||
|
||||
#[type_length_limit="0100"]
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
mod type_length_limit {
|
||||
mod inner { #![type_length_limit="0100"] }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be in the root module
|
||||
//~^ WARN crate-level attribute should be in the root module
|
||||
|
||||
#[type_length_limit="0100"] fn f() { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[type_length_limit="0100"] struct S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[type_length_limit="0100"] type T = S;
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
|
||||
#[type_length_limit="0100"] impl S { }
|
||||
//~^ WARN unused attribute
|
||||
//~| WARN crate-level attribute should be an inner attribute
|
||||
//~^ WARN crate-level attribute should be an inner attribute
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#![deny(unused_attributes)]
|
||||
#![feature(plugin)]
|
||||
|
||||
#[plugin(bla)] //~ ERROR unused attribute
|
||||
//~^ ERROR should be an inner attribute
|
||||
#[plugin(bla)] //~ ERROR should be an inner attribute
|
||||
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LL | #[plugin(bla)]
|
|||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: unused attribute
|
||||
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
|
||||
--> $DIR/invalid-plugin-attr.rs:4:1
|
||||
|
|
||||
LL | #[plugin(bla)]
|
||||
|
|
@ -18,11 +18,5 @@ note: the lint level is defined here
|
|||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
|
||||
--> $DIR/invalid-plugin-attr.rs:4:1
|
||||
|
|
||||
LL | #[plugin(bla)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
#![deny(unused_attributes)]
|
||||
|
||||
mod a {
|
||||
#![crate_type = "bin"] //~ ERROR unused attribute
|
||||
//~^ ERROR should be in the root module
|
||||
#![crate_type = "bin"] //~ ERROR should be in the root module
|
||||
}
|
||||
|
||||
#[crate_type = "bin"] fn main() {} //~ ERROR unused attribute
|
||||
//~^ ERROR should be an inner
|
||||
#[crate_type = "bin"] fn main() {} //~ ERROR should be an inner
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: unused attribute
|
||||
error: crate-level attribute should be in the root module
|
||||
--> $DIR/lint-misplaced-attr.rs:7:5
|
||||
|
|
||||
LL | #![crate_type = "bin"]
|
||||
|
|
@ -10,23 +10,11 @@ note: the lint level is defined here
|
|||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: crate-level attribute should be in the root module
|
||||
--> $DIR/lint-misplaced-attr.rs:7:5
|
||||
|
|
||||
LL | #![crate_type = "bin"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/lint-misplaced-attr.rs:11:1
|
||||
|
|
||||
LL | #[crate_type = "bin"] fn main() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
|
||||
--> $DIR/lint-misplaced-attr.rs:11:1
|
||||
--> $DIR/lint-misplaced-attr.rs:10:1
|
||||
|
|
||||
LL | #[crate_type = "bin"] fn main() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
// A sample of various built-in attributes.
|
||||
#[macro_export]
|
||||
#[macro_use] //~ ERROR unused attribute
|
||||
#[path="foo"] //~ ERROR unused attribute
|
||||
#[recursion_limit="1"] //~ ERROR unused attribute
|
||||
//~| ERROR crate-level attribute should be an inner attribute
|
||||
#[macro_use] //~ ERROR `#[macro_use]` only has an effect
|
||||
#[path="foo"] //~ ERROR #[path]` only has an effect
|
||||
#[recursion_limit="1"] //~ ERROR crate-level attribute should be an inner attribute
|
||||
macro_rules! foo {
|
||||
() => {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: unused attribute
|
||||
error: `#[macro_use]` only has an effect on `extern crate` and modules
|
||||
--> $DIR/unused-attr-macro-rules.rs:7:1
|
||||
|
|
||||
LL | #[macro_use]
|
||||
|
|
@ -10,23 +10,17 @@ note: the lint level is defined here
|
|||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
error: `#[path]` only has an effect on modules
|
||||
--> $DIR/unused-attr-macro-rules.rs:8:1
|
||||
|
|
||||
LL | #[path="foo"]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr-macro-rules.rs:9:1
|
||||
|
|
||||
LL | #[recursion_limit="1"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
|
||||
--> $DIR/unused-attr-macro-rules.rs:9:1
|
||||
|
|
||||
LL | #[recursion_limit="1"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
#![deny(unused_attributes)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#![rustc_dummy] //~ ERROR unused attribute
|
||||
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
extern crate core;
|
||||
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
use std::collections;
|
||||
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
extern "C" {
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
fn foo();
|
||||
}
|
||||
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
mod foo {
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
pub enum Foo {
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
Bar,
|
||||
}
|
||||
}
|
||||
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
fn bar(f: foo::Foo) {
|
||||
match f {
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
foo::Foo::Bar => {}
|
||||
}
|
||||
}
|
||||
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
struct Foo {
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
a: isize
|
||||
}
|
||||
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
trait Baz {
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
fn blah(&self);
|
||||
#[rustc_dummy] //~ ERROR unused attribute
|
||||
fn blah2(&self) {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:4:1
|
||||
|
|
||||
LL | #![rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unused-attr.rs:1:9
|
||||
|
|
||||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:6:1
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:9:1
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:12:1
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:14:5
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:18:1
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:20:5
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:22:9
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:27:1
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:30:9
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:35:1
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:37:5
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:41:1
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:43:5
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr.rs:45:5
|
||||
|
|
||||
LL | #[rustc_dummy]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue