-Z allow-features does not apply to -Z flags
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing rustc -Z allow-features= -Z always-encode-mir with the reported nightly compiler, then trace how allow-features is checked against command-line -Z flags. Confirm the current behavior and identify the relevant compiler tests or flag-validation entry point. Done means an unlisted unstable flag produces a hard error while an allowed flag remains accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100