Skip to content

-Z allow-features does not apply to -Z flags #139890

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

Open
jyn514 opened this issue Apr 16, 2025 · 1 comment
Open

-Z allow-features does not apply to -Z flags #139890

jyn514 opened this issue Apr 16, 2025 · 1 comment
Labels
A-CLI Area: Command-line interface (CLI) to the compiler A-stability Area: `#[stable]`, `#[unstable]` etc. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 16, 2025

I tried this code: rustc -Z allow-features= -Z always-encode-mir

I expected to see this happen: rustc gives a hard error that always-encode-mir was not listed in allow-features.

Instead, this happened: rustc silently accepts the -Z flag.

It feels very natural to me that this should apply to flags, not just source code, by the same logic you'd want it anywhere: it gives the person running the build control over what unstable features they use, instead of unknowingly enabling features from the myriad sources that cargo picks up rustflags.

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (43f0014ef 2025-03-25)
@jyn514 jyn514 added the C-bug Category: This is a bug. label Apr 16, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 16, 2025
@jyn514
Copy link
Member Author

jyn514 commented Apr 17, 2025

@jieyouxu jieyouxu added A-stability Area: `#[stable]`, `#[unstable]` etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-CLI Area: Command-line interface (CLI) to the compiler and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: Command-line interface (CLI) to the compiler A-stability Area: `#[stable]`, `#[unstable]` etc. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants