-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -Z allow_features=...
flag
#59169
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,10 @@ | ||
// compile-flags: -Z allow_features= | ||
// Note: This test uses rustc internal flags because they will never stabilize. | ||
|
||
#![feature(rustc_diagnostic_macros)] //~ ERROR | ||
|
||
#![feature(rustc_const_unstable)] //~ ERROR | ||
|
||
#![feature(lang_items)] //~ ERROR | ||
|
||
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,21 @@ | ||
error[E0725]: the feature `rustc_diagnostic_macros` is not in the list of allowed features | ||
--> $DIR/allow-features-empty.rs:4:12 | ||
| | ||
LL | #![feature(rustc_diagnostic_macros)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0725]: the feature `rustc_const_unstable` is not in the list of allowed features | ||
--> $DIR/allow-features-empty.rs:6:12 | ||
| | ||
LL | #![feature(rustc_const_unstable)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0725]: the feature `lang_items` is not in the list of allowed features | ||
--> $DIR/allow-features-empty.rs:8:12 | ||
| | ||
LL | #![feature(lang_items)] | ||
| ^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0725`. |
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,10 @@ | ||
// compile-flags: -Z allow_features=rustc_diagnostic_macros,lang_items | ||
// Note: This test uses rustc internal flags because they will never stabilize. | ||
|
||
#![feature(rustc_diagnostic_macros)] | ||
|
||
#![feature(rustc_const_unstable)] //~ ERROR | ||
|
||
#![feature(lang_items)] | ||
|
||
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,9 @@ | ||
error[E0725]: the feature `rustc_const_unstable` is not in the list of allowed features | ||
--> $DIR/allow-features.rs:6:12 | ||
| | ||
LL | #![feature(rustc_const_unstable)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0725`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will this do if we see the flag multiple times?
I think we have this sort of problem all over the place, I would prefer if
-Z allow_features=foo -Z allow_features=bar
worked like-Z allow_features=foo,bar
.cc @rust-lang/compiler Should we do an audit? It's plausible fixing some of the other flags to do "the right thing" when provided multiple times may be a breaking change.
At least this one is unstable though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the flag is supplied multiple times the last invocation will override the previous ones. This is (afaict) the behavior of all the -Z flags that take a list of arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and I'm saying it's not intentional most of the time, it just arises from how the CLI arguments are parsed.
I wonder what would happen were we to try to switch to e.g.
structopt
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, was responding in answer to your original "What will this do if we see the flag multiple times?"-- I agree that trying to shift everything over to a different behavior would be a worthwhile thing to investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #59219