-
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.
- Loading branch information
Showing
16 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/doc/unstable-book/src/language-features/cfg-attr-multi.md
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 @@ | ||
# `cfg_attr_multi` | ||
|
||
The tracking issue for this feature is: [#555666] | ||
The RFC for this feature is: [#2539] | ||
|
||
[#555666]: https://github.com/rust-lang/rust/issues/555666 | ||
[#2539]: https://github.com/rust-lang/rfcs/pull/2539 | ||
|
||
------------------------ | ||
|
||
This feature flag lets you put multiple attributes into a `cfg_attr` attribute. | ||
|
||
Example: | ||
|
||
```rust,ignore | ||
#[cfg_attr(all(), must_use, optimize)] | ||
``` | ||
|
||
Because `cfg_attr` resolves before procedural macros, this does not affect | ||
macro resolution at all. |
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
2 changes: 1 addition & 1 deletion
2
src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.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
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
2 changes: 1 addition & 1 deletion
2
src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.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
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
10 changes: 5 additions & 5 deletions
10
src/test/ui/conditional-compilation/cfg-attr-multi-true.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
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,5 @@ | ||
// gate-test-cfg_attr_multi | ||
|
||
#![cfg_attr(all(), warn(nonstandard_style), allow(unused_attributes))] | ||
//~^ ERROR cfg_attr with zero or more than one attributes is experimental | ||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.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,11 @@ | ||
error[E0658]: cfg_attr with zero or more than one attributes is experimental (see issue #555666) | ||
--> $DIR/feature-gate-cfg-attr-multi-1.rs:3:1 | ||
| | ||
LL | #![cfg_attr(all(), warn(nonstandard_style), allow(unused_attributes))] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(cfg_attr_multi)] to the crate attributes to enable | ||
|
||
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,3 @@ | ||
#![cfg_attr(all(),)] | ||
//~^ ERROR cfg_attr with zero or more than one attributes is experimental | ||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.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,11 @@ | ||
error[E0658]: cfg_attr with zero or more than one attributes is experimental (see issue #555666) | ||
--> $DIR/feature-gate-cfg-attr-multi-2.rs:1:1 | ||
| | ||
LL | #![cfg_attr(all(),)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(cfg_attr_multi)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
7 changes: 7 additions & 0 deletions
7
src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-1.rs
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,7 @@ | ||
// Test that settingt the featute gate while using its functionality doesn't error. | ||
|
||
// compile-pass | ||
|
||
#![cfg_attr(all(), feature(cfg_attr_multi), crate_type="bin")] | ||
|
||
fn main() {} |
9 changes: 9 additions & 0 deletions
9
src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-2.rs
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,9 @@ | ||
// Test that settingt the featute gate while using its functionality doesn't error. | ||
// Specifically, if there's a cfg-attr *before* the feature gate. | ||
|
||
// compile-pass | ||
|
||
#![cfg_attr(all(),)] | ||
#![cfg_attr(all(), feature(cfg_attr_multi), crate_type="bin")] | ||
|
||
fn main() {} |