Open
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-features
cap-lints
linked 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