forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#59169 - tmandry:allow-features-flag, r=cram…
…ertj Add `-Z allow_features=...` flag Adds a compiler option to allow only whitelisted features. For projects on nightly that want to prevent feature-creep (and maybe, someday, move off of nightly). Not being able to enforce this has been a problem on Fuchsia and at other big companies. This doesn't support filtering edition feature flags, but someone is welcome to add that if they need it.
- Loading branch information
Showing
9 changed files
with
98 additions
and
4 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,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`. |