Skip to content

Rework explanation of CLI lint level flags#152725

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
ehuss:lint-level-cli
Feb 18, 2026
Merged

Rework explanation of CLI lint level flags#152725
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
ehuss:lint-level-cli

Conversation

@ehuss
Copy link
Contributor

@ehuss ehuss commented Feb 16, 2026

I think the previous wording as either wrong or confusing. I would consider the CLI flags at a lower ranking, since source attributes are able to override the CLI flag.

I think the previous wording as either wrong or confusing. I would
consider the CLI flags at a *lower* ranking, since source attributes are
able to override the CLI flag.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 16, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 16, 2026

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, compiler
  • @ehuss, compiler expanded to 69 candidates
  • Random selection from 14 candidates

@jieyouxu jieyouxu self-assigned this Feb 18, 2026
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, this broadly looks right to me.

There are more nuance with how lint groups interact versus component lints, and how those interact with the special psuedo lint groups. I wanted to spend some time to look into the precedence but never got around to it. cf. #142610

In any case, this PR makes it more accurate.

View changes since this review

```
3. [CLI level flags](#via-compiler-flag) take precedence over attributes.
3. [CLI level flags](#via-compiler-flag) override the default level of a lint. They essentially behave like crate-level attributes. Attributes within the source code take precedence over CLI flags, except for `-F`/`--forbid`, which cannot be overridden.
Copy link
Member

Choose a reason for hiding this comment

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

Remark: hm, last I recall the cli lint levels behave as if they are a "synthetic" crate level attr yes (but one layer "outer"). Though I seem to recall the adjust logic is sometimes a bit convoluted, especially when it comes to precedence on the same "node".

@jieyouxu
Copy link
Member

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 18, 2026

📌 Commit 3099121 has been approved by jieyouxu

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 18, 2026
rust-bors bot pushed a commit that referenced this pull request Feb 18, 2026
Rollup of 20 pull requests

Successful merges:

 - #145399 (Unify wording of resolve error)
 - #150473 (tail calls: fix copying non-scalar arguments to callee)
 - #152637 (Add a note about elided lifetime)
 - #152729 (compiler: Don't mark `SingleUseConsts` MIR pass as "required for soundness")
 - #152751 (Rename dep node "fingerprints" to distinguish key and value hashes)
 - #152753 (remove the explicit error for old `rental` versions)
 - #152758 (Remove ShallowInitBox.)
 - #151530 (Fix invalid `mut T` suggestion for `&mut T` in missing lifetime error)
 - #152179 (Add documentation note about signed overflow direction)
 - #152474 (Implement opt-bisect-limit for MIR)
 - #152509 (tests/ui/test-attrs: add annotations for reference rules)
 - #152672 (std: use libc version of `_NSGetArgc`/`_NSGetArgv`)
 - #152711 (resolve: Disable an assert that no longer holds)
 - #152725 (Rework explanation of CLI lint level flags)
 - #152732 (add regression test for 147958)
 - #152745 (Fix ICE in `suggest_param_env_shadowing` with incompatible args)
 - #152749 (make `rustc_allow_const_fn_unstable` an actual `rustc_attrs` attribute)
 - #152756 (Miri: recursive validity: also recurse into Boxes)
 - #152770 (carryless_mul: mention the base)
 - #152778 (Update tracking issue number for final_associated_functions)
@rust-bors rust-bors bot merged commit f7d5a64 into rust-lang:main Feb 18, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 18, 2026
rust-timer added a commit that referenced this pull request Feb 18, 2026
Rollup merge of #152725 - ehuss:lint-level-cli, r=jieyouxu

Rework explanation of CLI lint level flags

I think the previous wording as either wrong or confusing. I would consider the CLI flags at a *lower* ranking, since source attributes are able to override the CLI flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments