Rework explanation of CLI lint level flags#152725
Rework explanation of CLI lint level flags#152725rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
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 has assigned @dingxiangfei2009. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
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.
| ``` | ||
| 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. |
There was a problem hiding this comment.
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".
|
@bors r+ rollup |
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)
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.
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.