Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jyn514 opened this issue Apr 17, 2025 · 2 comments
Open

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

jyn514 opened this issue Apr 17, 2025 · 2 comments
Labels
A-CLI Area: Command-line interface (CLI) to the compiler C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 17, 2025

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 (78f2104 2025-04-16)

@jyn514 jyn514 added the C-bug Category: This is a bug. label Apr 17, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 17, 2025
@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-CLI Area: Command-line interface (CLI) to the compiler and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 17, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Apr 17, 2025

Tbh I kinda expected -Zallow-features=ffi_pure -Z allow-features=rustc_attrs would be equivalent to e.g. -Zallow-features=ffi_pure,rustc_attrs but then I remembered the -Zallow-features= case...

@jyn514
Copy link
Member Author

jyn514 commented Apr 17, 2025

yeah i think if we combine them at all it should be an AND, not an OR. but it would be better to give a hard error imo, and we certainly shouldn't silently discard one of them. the whole point of allow-features is that different parties do not trust each other, we should never silently ignore an allow-features flag.

@fmease fmease added the requires-nightly This issue requires a nightly compiler in some way. label Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: Command-line interface (CLI) to the compiler C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants