if multiple `-Z allow-features` are passed, only the last is used
Open
Nobody has claimed this yet.
A-CLI
C-bug
requires-nightly
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
rustc +nightly -Zallow-features=ffi_pure -Z allow-features=rustc_attrs src/main.rs
I expected to see this happen: A hard error. It does not make sense to combine allow-features; should they be OR-d or AND-ed?
Instead, this happened: Neither an OR nor an AND. Instead the first flag was ignored altogether.
error[E0725]: the feature `ffi_pure` is not in the list of allowed features
--> src/main.rs:2:12
|
2 | #![feature(ffi_pure, rustc_private)]
| ^^^^^^^^
Meta
rustc --version --verbose: rustc 1.88.0-nightly (78f2104e3 2025-04-16)
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
Reproduce the issue with the shown rustc command and inspect how repeated -Z allow-features arguments are parsed. Establish whether repeated values should be combined or rejected, then verify that the chosen behavior handles both features and no longer silently ignores the first flag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100