Skip to content

Clippy subtree update #143745

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

Draft
wants to merge 118 commits into
base: master
Choose a base branch
from
Draft

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Jul 10, 2025

r? @Manishearth

Cargo.lock update due to ui_test bump and restructure.

Alexendoo and others added 30 commits May 16, 2025 01:07
The `TyCtxt::hir_get_fn_id_for_return_block()` function was too broad,
as it will return positively even when given part of an expression that can
be used as a return value. A new `potential_return_of_enclosing_body()`
utility function has been made to represent the fact that an expression
might be directly returned from its enclosing body.
This commit also adds more test cases, which work fine but were
mentioned in the issue.
…links-expansion, r=lolbinarycat

[rustdoc] Do not emit redundant_explicit_links lint if the doc comment comes from expansion

Fixes rust-lang#141553.

The problem was that we change the context for the attributes in some cases to get better error output, preventing us to detect if the attribute comes from expansion. Most of the changes are about keeping track of the "does this span comes from expansion" information.

r? ```@Manishearth```
The lint was extra restrictive, and didn't suggest using
`core::ptr::null` and `core::ptr::null_mut` in `const` contexts although
they have been const-stabilized since Rust 1.24.
…=fee1-dead

New const traits syntax

This PR only affects the AST and doesn't actually change anything semantically.

All occurrences of `~const` outside of libcore have been replaced by `[const]`. Within libcore we have to wait for rustfmt to be bumped in the bootstrap compiler. This will happen "automatically" (when rustfmt is run) during the bootstrap bump, as rustfmt converts `~const` into `[const]`. After this we can remove the `~const` support from the parser

Caveat discovered during impl: there is no legacy bare trait object recovery for `[const] Trait` as that snippet in type position goes down the slice /array parsing code and will error

r? ``@fee1-dead``

cc ``@nikomatsakis`` ``@traviscross`` ``@compiler-errors``
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#139858 (New const traits syntax)
 - rust-lang#140809 (Reduce special casing for the panic runtime)
 - rust-lang#142730 (suggest declaring modules when file found but module not defined)
 - rust-lang#142806 (Normalize before computing ConstArgHasType goal in new solver)
 - rust-lang#143046 (const validation: properly ignore zero-sized UnsafeCell)
 - rust-lang#143092 (const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology)
 - rust-lang#143096 (tag_for_variant: properly pass TypingEnv)
 - rust-lang#143104 (hir_analysis: prohibit `dyn PointeeSized`)
 - rust-lang#143106 (gce: don't ICE on non-local const)

Failed merges:

 - rust-lang#143036 (Remove support for `dyn*` from the compiler)

r? `@ghost`
`@rustbot` modify labels: rollup
The lint was extra restrictive, and didn't suggest using
`core::ptr::null` and `core::ptr::null_mut` in `const` contexts although
they have been const-stabilized since Rust 1.24.

changelog: [`zero_ptr`]: lint in `const` context as well

@rustbot label +I-false-negative +C-bug
…15123)

Closes rust-lang/rust-clippy#15116

The cause for this issue is that `_` belongs to the `Common` catagory in
unicode instead of `Latin` like other ASCII alphabets. Since ASCII
characters are always allowed, I just added an extra `is_ascii()` check
to ensure this.

changelog: [`disallowed_script_idents`] fix FP on identifiers with `_`
Jared-Prime and others added 17 commits July 7, 2025 15:56
fix: check against 'main' function name instead of entrypoint function
Full list of `impl const Default` types:

- ()
- bool
- char
- Cell
- std::ascii::Char
- usize
- u8
- u16
- u32
- u64
- u128
- i8
- i16
- i32
- i64
- i128
- f16
- f32
- f64
- f128
- std::marker::PhantomData<T>
- Option<T>
- std::iter::Empty<T>
- std::ptr::Alignment
- &[T]
- &mut [T]
- &str
- &mut str
- String
- Vec<T>
changelog: [`exit`]: When using the `--test` or `--all-targets` flag,
the exit lint should not fail on the main function.

Fixes rust-lang/rust-clippy#13518

With help from @sesgoe
Previously rust-lang/triagebot#1985

After a lintcheck run a comment will be created in the PR thread with an
overview of the changes, example here
Alexendoo/rust-clippy#18 (comment)
(plus the normal GHA debugging experience)

It will only comment if there are some changes, if there's already an
existing comment it will be updated for each run

Similar to
https://github.com/rust-lang/team/blob/master/.github/workflows/dry-run.yml

The PR number is supplied by the lintcheck run, so technically someone
could forge it to be annoying and edit the summaries in other threads,
but that is pretty low impact and easy to deal with. There is a
`pull_requests` field on the event but as @Kobzol [pointed out to
me](rust-lang/triagebot#1985 (comment))
it's not populated for PRs from forks

r? @flip1995

changelog: none
I think it's pretty common for a lint to be proposed for clippy only for
consensus to be it belongs in rustc, and additionally sometimes bugs get
filed here when the fault is actually with rustc.

https://forge.rust-lang.org/triagebot/transfer.html#issue-transfer

changelog: none
Propose to replace `x.map_or(false, |y| y == z)` by `x == Some(z)` only
if `x` is not adjusted. Otherwise, the type of `x` in the comparaison
may not be the expected one, as it may be the product of an auto-deref.

changelog: [`unnecessary_map_or`]: do not propose to replace the
`map_or` call by a comparaison if types wouldn't be correct

Fixes rust-lang/rust-clippy#15180
When comparing `x.map(func) == Some(bool_lit)`, the value of `bool_lit`
was ignored, despite the fact that its value should determine the value
of the proposed expression.

`func` can be either a closure or a path. For the latter, η-expansion
will be used if needed to invert the result of the function call.

changelog: [`manual_is_variant_and`]: fix inverted suggestions that
could lead to code with different semantics

Fixes rust-lang/rust-clippy#15202

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[Beta-nomination](rust-lang/rust-clippy#15206 (comment))
by [samueltardieu](https://github.com/samueltardieu)

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
Closes rust-lang/rust-clippy#15063

----

changelog: [`op_ref`]: fix wrongly showed macro definition in
suggestions
changelog: [`needless_bool_assign`]: fix missing curlies when on else if
r? @ghost

changelog: none
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 10, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@flip1995 flip1995 force-pushed the clippy-subtree-update branch from f1dca6b to 69fca56 Compare July 10, 2025 18:34
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jul 10, 2025
Cargo.toml Outdated
@@ -12,6 +12,7 @@ members = [
"src/tools/bump-stage0",
"src/tools/cargotest",
"src/tools/clippy",
"src/tools/clippy/clippy_test_deps",
Copy link
Member Author

Choose a reason for hiding this comment

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

@RalfJung I added this to the Cargo.toml to make the tests pass. Is this correct?

Copy link
Member

Choose a reason for hiding this comment

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

Hm, that seems odd, I don't think we did that for Miri. It should probably be excluded from the workspace, so that it can have its own lockfile checked in.

Copy link
Member

Choose a reason for hiding this comment

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

But for Miri we didn't have to manually exclude anything.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I'll look into this tomorrow. Does miri have a Cargo.lock file checked in?

Copy link
Member

Choose a reason for hiding this comment

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

For the deps, yes: https://github.com/rust-lang/rust/tree/master/src/tools/miri/test_dependencies.

Miri itself is part of the cargo workspace so it uses the big lockfile in the root, when it is built via ./x. The lockfile in src/tools/miri only exists because it is synced from the subrepo, and is only used for subrepo builds.

@rust-log-analyzer

This comment has been minimized.

@flip1995 flip1995 force-pushed the clippy-subtree-update branch from 988bba3 to c629a45 Compare July 10, 2025 18:45
@flip1995 flip1995 marked this pull request as draft July 10, 2025 20:05
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.