-
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 arbitrary tokens in non-macro attributes with a separate…
… gate Feature gate `rustc_` and `derive_` with their own gates again instead of `custom_attribute`
- Loading branch information
1 parent
0aa8d03
commit d2f5637
Showing
12 changed files
with
144 additions
and
69 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
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,18 @@ | ||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// ignore-tidy-linelength | ||
|
||
// Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate. | ||
|
||
#[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable | ||
#[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable | ||
|
||
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,19 @@ | ||
error[E0658]: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) | ||
--> $DIR/feature-gate-rustc-attrs-1.rs:15:1 | ||
| | ||
LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) | ||
--> $DIR/feature-gate-rustc-attrs-1.rs:16:1 | ||
| | ||
LL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error: aborting due to 2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,11 @@ | ||
error[E0658]: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) | ||
--> $DIR/feature-gate-rustc-attrs.rs:15:1 | ||
| | ||
LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) | ||
--> $DIR/feature-gate-rustc-attrs.rs:16:1 | ||
| | ||
LL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) | ||
--> $DIR/feature-gate-rustc-attrs.rs:17:1 | ||
--> $DIR/feature-gate-rustc-attrs.rs:15:1 | ||
| | ||
LL | #[rustc_foo] | ||
| ^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable | ||
|
||
error: aborting due to 3 previous errors | ||
error: aborting due to previous error | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![feature(custom_attribute)] | ||
|
||
#[my_attr(a b c d)] | ||
//~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `b` | ||
//~| ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `c` | ||
//~| ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `d` | ||
fn main() {} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/feature-gate-unrestricted-attribute-tokens.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: expected one of `(`, `)`, `,`, `::`, or `=`, found `b` | ||
--> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:13 | ||
| | ||
LL | #[my_attr(a b c d)] | ||
| ^ expected one of `(`, `)`, `,`, `::`, or `=` here | ||
|
||
error: expected one of `(`, `)`, `,`, `::`, or `=`, found `c` | ||
--> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:15 | ||
| | ||
LL | #[my_attr(a b c d)] | ||
| ^ expected one of `(`, `)`, `,`, `::`, or `=` here | ||
|
||
error: expected one of `(`, `)`, `,`, `::`, or `=`, found `d` | ||
--> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:17 | ||
| | ||
LL | #[my_attr(a b c d)] | ||
| ^ expected one of `(`, `)`, `,`, `::`, or `=` here | ||
|
||
error: aborting due to 3 previous errors | ||
|