forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unused attributes on macro_rules.
- Loading branch information
Showing
4 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#![deny(unused_attributes)] | ||
// Unused attributes on macro_rules requires special handling since the | ||
// macro_rules definition does not survive towards HIR. | ||
|
||
// 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_rules! foo { | ||
() => {}; | ||
} | ||
|
||
// The following should not warn about unused attributes. | ||
#[allow(unused)] | ||
macro_rules! foo2 { | ||
() => {}; | ||
} | ||
|
||
#[cfg(FALSE)] | ||
macro_rules! foo { | ||
() => {}; | ||
} | ||
|
||
/// Some docs | ||
#[deprecated] | ||
#[doc = "more docs"] | ||
#[macro_export] | ||
macro_rules! bar { | ||
() => {}; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
error: unused attribute | ||
--> $DIR/unused-attr-macro-rules.rs:7:1 | ||
| | ||
LL | #[macro_use] | ||
| ^^^^^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/unused-attr-macro-rules.rs:1:9 | ||
| | ||
LL | #![deny(unused_attributes)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: unused attribute | ||
--> $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 | ||
|