rust-lang / rust-lang/rust

if multiple `-Z allow-features` are passed, only the last is used

Open
#139,947 2 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.