Please document how many times a compiler flag is recognized, or stop for more occurences than needed
Open
Nobody has claimed this yet.
A-CLI
A-docs
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I noticed some flags can be passed to the compiler multiple times and they are all used by the rustc, while some flags are able to be fed to rustc multiple times but only the first/last occurence is used.
Examples:
- accepted and recognized multiple times
-L-Zcrate-attr- ...
- accepted multiple times, but only the first is recognized
- accepted multiple times, but only the last is recognized
-Zallow-featurescap-lintslinked above tends to be this in the future :)
To confirm that only the last -Zallow-features is recognized.
// tool-attr.rs
#[rapx::a]
fn main() {}
$ rustc tool-attr.rs -Zallow-features=register_tool -Zallow-features=asm_const -Zcrate-attr="feature(register_tool)" -Zcrate-attr="register_tool(rapx)"
error[E0725]: the feature `register_tool` is not in the list of allowed features
--> <crate attribute>:1:12
|
1 | #![feature(register_tool)]
| ^^^^^^^^^^^^^
error[E0658]: the `#[register_tool]` attribute is an experimental feature
--> <crate attribute>:1:1
|
1 | #![register_tool(rapx)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #66079 <https://github.com/rust-lang/rust/issues/66079> for more information
= help: add `#![feature(register_tool)]` to the crate attributes to enable
= note: this compiler was built on 2025-06-13; consider upgrading it if it is out of date
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 the rustc command in the issue and compare repeated -L, -Zcrate-attr, and -Zallow-features flags. The issue names no files or tests; done requires choosing and implementing or documenting a consistent occurrence policy for compiler flags, with coverage for the cited examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100