-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve: Reserve a few very special names in macro namespace
- Loading branch information
1 parent
65c8c97
commit de153d6
Showing
7 changed files
with
62 additions
and
52 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
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,22 @@ | ||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
use proc_macro::*; | ||
|
||
#[proc_macro_attribute] | ||
pub fn cfg(_: TokenStream, input: TokenStream) -> TokenStream { | ||
//~^ ERROR name `cfg` is reserved in macro namespace | ||
input | ||
} | ||
|
||
#[proc_macro_attribute] | ||
pub fn cfg_attr(_: TokenStream, input: TokenStream) -> TokenStream { | ||
//~^ ERROR name `cfg_attr` is reserved in macro namespace | ||
input | ||
} | ||
|
||
#[proc_macro_attribute] | ||
pub fn derive(_: TokenStream, input: TokenStream) -> TokenStream { | ||
//~^ ERROR name `derive` is reserved in macro namespace | ||
input | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/ui-fulldeps/proc-macro/reserved-macro-names.stderr
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,20 @@ | ||
error: name `cfg` is reserved in macro namespace | ||
--> $DIR/reserved-macro-names.rs:7:8 | ||
| | ||
LL | pub fn cfg(_: TokenStream, input: TokenStream) -> TokenStream { | ||
| ^^^ | ||
|
||
error: name `cfg_attr` is reserved in macro namespace | ||
--> $DIR/reserved-macro-names.rs:13:8 | ||
| | ||
LL | pub fn cfg_attr(_: TokenStream, input: TokenStream) -> TokenStream { | ||
| ^^^^^^^^ | ||
|
||
error: name `derive` is reserved in macro namespace | ||
--> $DIR/reserved-macro-names.rs:19:8 | ||
| | ||
LL | pub fn derive(_: TokenStream, input: TokenStream) -> TokenStream { | ||
| ^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|