-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature gate
rustc
attributes harder
- Loading branch information
1 parent
0ffb643
commit e4e7eb2
Showing
11 changed files
with
132 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
// Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate. | ||
|
||
#![feature(decl_macro)] | ||
|
||
mod rustc { pub macro unknown() {} } | ||
mod unknown { pub macro rustc() {} } | ||
|
||
#[rustc::unknown] | ||
//~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler | ||
//~| ERROR macro `rustc::unknown` may not be used in attributes | ||
fn f() {} | ||
|
||
#[unknown::rustc] | ||
//~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler | ||
//~| ERROR macro `unknown::rustc` may not be used in attributes | ||
fn g() {} | ||
|
||
#[rustc_dummy] | ||
//~^ ERROR used by the test suite | ||
|
||
#[rustc_unknown] | ||
//~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler | ||
//~| ERROR attribute `rustc_unknown` is currently unknown | ||
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 |
---|---|---|
@@ -1,12 +1,60 @@ | ||
error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler | ||
--> $DIR/feature-gate-rustc-attrs.rs:8:3 | ||
| | ||
LL | #[rustc::unknown] | ||
| ^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642 | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error: macro `rustc::unknown` may not be used in attributes | ||
--> $DIR/feature-gate-rustc-attrs.rs:8:1 | ||
| | ||
LL | #[rustc::unknown] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler | ||
--> $DIR/feature-gate-rustc-attrs.rs:13:12 | ||
| | ||
LL | #[unknown::rustc] | ||
| ^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642 | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error: macro `unknown::rustc` may not be used in attributes | ||
--> $DIR/feature-gate-rustc-attrs.rs:13:1 | ||
| | ||
LL | #[unknown::rustc] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler | ||
--> $DIR/feature-gate-rustc-attrs.rs:20:3 | ||
| | ||
LL | #[rustc_unknown] | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642 | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error[E0658]: The attribute `rustc_unknown` is currently unknown to the compiler and may have meaning added to it in the future | ||
--> $DIR/feature-gate-rustc-attrs.rs:20:3 | ||
| | ||
LL | #[rustc_unknown] | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642 | ||
= help: add #![feature(custom_attribute)] to the crate attributes to enable | ||
|
||
error[E0658]: used by the test suite | ||
--> $DIR/feature-gate-rustc-attrs.rs:3:1 | ||
--> $DIR/feature-gate-rustc-attrs.rs:18:1 | ||
| | ||
LL | #[rustc_dummy] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642 | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 7 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
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