Skip to content

error when a command line flag lowers a -F forbid - #165669

Open
Albab-Hasan wants to merge 2 commits into
rust-lang:mainfrom
Albab-Hasan:cli-forbid-lowering-error
Open

Albab-Hasan wants to merge 2 commits into
rust-lang:mainfrom
Albab-Hasan:cli-forbid-lowering-error

Conversation

@Albab-Hasan

@Albab-Hasan Albab-Hasan commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

-F x -A x on the command line silently kept the forbid while the crate attribute form is E0453. now both error. groups hard error too instead of the forbidden_lint_groups fcw since the cli never let them lower a forbid.

the skip started as the #70918 hack for #70819 and #86970 moved it into add_command_line. related #133346 #81670

cc @jyn514

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 9, 2026
@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Error: Failed to set assignee to jyn514: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@jyn514

jyn514 commented Nov 9, 2026

Copy link
Copy Markdown
Member

r? compiler

@jyn514

jyn514 commented Nov 9, 2026

Copy link
Copy Markdown
Member

cc @folkertdev

@folkertdev folkertdev left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change looks fine but I'm unsure on the implications. This is, in a way, a breaking change, right?

r? JonathanBrouwer for a second opinion

View changes since this review

@jyn514

jyn514 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

yes, this is a breaking change. the motivation here is that we want to desugar -A flags to #![allow(...)] for the --crate-attr RFC.

@JonathanBrouwer JonathanBrouwer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm but would be nice if we could improve this diagnostic.
This definitely needs some kind of compiler sign-off though, probably a FCP.
I'll ask in internal zulip chats what we want here, I'll get back to you

View changes since this review

| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: requested on the command line with `-F unused-variables`
= note: `forbid` lint level was set on command line (`-F unused_variables`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diagnostic could also explain where the allow(unused) comes from, could you add a separate note for that?

a later `-A`, `-W` or `--force-warn` for a lint forbidden by an earlier `-F` was silently ignored while the same order as crate attributes is E0453. command line levels now go through `insert_spec` like attributes so `-F dead_code -A dead_code` is E0453 too. lint groups also hard error instead of the `forbidden_lint_groups` future compat warning since the command line never let them lower a forbid.
the E0453 for a command line flag has no span so it only said where the `forbid` came from. it now also names the flag that tried to lower it.
@Albab-Hasan
Albab-Hasan force-pushed the cli-forbid-lowering-error branch from 95dff70 to 615f932 Compare November 13, 2026 19:07
@rustbot

rustbot commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Albab-Hasan

Copy link
Copy Markdown
Contributor Author

added the note so it now says allow lint level was set on command line (-A unused) above the forbid one. if this ends up needing an fcp i can write the summary for it if that helps :)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants