Skip to content

Clippy subtree update #124123

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

Merged
merged 81 commits into from
Apr 19, 2024
Merged

Clippy subtree update #124123

merged 81 commits into from
Apr 19, 2024

Conversation

flip1995
Copy link
Member

y21 and others added 30 commits March 29, 2024 16:24
Removed the `from_expansion` guard clause for cast lints, so that these warnings can be generated for internal macros.
Clippy no longer adds unnecessary parentheses in suggestion when the expression is a part of a tuple.
…age, r=Jarcho

Reword `arc_with_non_send_sync` note and help messages

Addresses rust-lang/rust-clippy#12608 (comment)

Makes the note more concise and reframes the `Rc` suggestion around whether it crosses threads currently due to a manual `Send`/`Sync` impl or may do in the future

changelog: none
type certainty: clear `DefId` when an expression's type changes to non-adt

Fixes rust-lang#12585

The root cause of the ICE in the linked issue was in the expression `one.x`, in the array literal.

The type of `one` is the `One` struct: an adt with a DefId, so its certainty is `Certain(def_id_of_one)`. However, the field access `.x` can then change the type (to `i32` here) and that should update that `DefId` accordingly. It does do that correctly when `one.x` would be another adt with a DefId:

https://github.com/rust-lang/rust-clippy/blob/97ba291d5aa026353ad93e48cf00e06f08c73830/clippy_utils/src/ty/type_certainty/mod.rs#L90-L91

but when it *isn't* an adt and there is no def id (which is the case in the linked issue: `one.x` is an i32), it keeps the `DefId` of `One`, even though that's the wrong type (which would then lead to a contradiction later when joining `Certainty`s):
https://github.com/rust-lang/rust-clippy/blob/97ba291d5aa026353ad93e48cf00e06f08c73830/clippy_utils/src/ty/type_certainty/mod.rs#L92-L93

In particular, in the linked issue, `from_array([one.x, two.x])` would try to join the `Certainty` of the two array elements, which *should* have been `[Certain(None), Certain(None)]`, because `i32`s have no `DefId`, but instead it was `[Certain(One), Certain(Two)]`, because the DefId wasn't cleared from when it was visiting `one` and `two`. This is the "contradiction" that could be seen in the ICE message

... so this changes it to clear the `DefId` when it isn't an adt.

cc `@smoelius` you implemented this initially in rust-lang#11135, does this change make sense to you?

changelog: none
Allow `cast` lints in macros

closes: rust-lang#11738

Removed the `from_expansion` guard clause for cast lints, so that these warnings can be generated for internal macros.

changelog: allow `cast` lints in macros
fix ice reporting in lintcheck

Fixes rust-lang/rust-clippy#12185

This PR fixes the lack of reported ICEs within lintcheck by modifying the way in which data is collected from each crate being linted.

Instead of lintcheck only reading `stdout` for warnings, it now also reads `stderr` for any potential ICE (although admittedly, it is not the cleanest method of doing so). If it is detected, it parses the ICE into its message and backtrace separately, and then adds them to the list of outputs via clippy.

Once all outputs are collected, the formatter then proceeds to generate the file as normal.

Note that this PR also has a couple of side effects:
- When clippy fails to process a package, but said failure is not an ICE, the `stderr` will be sent to the console;
- Instead of `ClippyWarning` being the primary struct for everything reported, there is now `ClippyCheckOutput`, an enum which splits the outputs into warnings and ICEs.

changelog: none
…thiaskrgr

Prevent PR assignments to `@matthiaskrgr`, `@giraffate`, and `@Centri3`

When commenting r? clippy, rustbot takes a random member from the team. I'm setting you kings and queen to be on vacation, so that rustbot doesn't target you.

---

changelog: none

cc: `@matthiaskrgr` `@giraffate` and `@Centri3`
…-12564, r=dswij

[`manual_unwrap_or_default`]: Check for Default trait implementation in initial condition when linting and use `IfLetOrMatch`

Fixes rust-lang#12564

changelog: Fix [`manual_unwrap_or_default`] false positive when initial `match`/`if let` condition doesn't implement `Default` but the return type does.
…cation, r=blyxyas

fix incorrect suggestion for `!(a as type >= b)`

fixes rust-lang#12625

The expression  `!(a as type >= b)` got simplified to `a as type < b`, but because of rust's parsing rules that `<` is interpreted as a start of generic arguments for `type`.  This is fixed by recognizing this case and adding extra parens around the left-hand side of the comparison.

changelog: [`nonminimal_bool`]: fix incorrect suggestion for  `!(a as type >= b)`
While they have many convenient APIs, it is better to expose dedicated functions for them
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 18, 2024
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Manishearth
Copy link
Member

@bors r+ p=1

@bors
Copy link
Collaborator

bors commented Apr 18, 2024

📌 Commit 9028e00 has been approved by Manishearth

It is now in the queue for this repository.

@bors bors 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 Apr 18, 2024
@bors
Copy link
Collaborator

bors commented Apr 18, 2024

⌛ Testing commit 9028e00 with merge ce6f209...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 18, 2024
…nishearth

Clippy subtree update

r? `@Manishearth`
@bors
Copy link
Collaborator

bors commented Apr 18, 2024

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing ce6f209 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 18, 2024
@bors
Copy link
Collaborator

bors commented Apr 18, 2024

👀 Test was successful, but fast-forwarding failed: 422 Update is not a fast forward

@Manishearth
Copy link
Member

@bors retry

what

@bors
Copy link
Collaborator

bors commented Apr 18, 2024

⌛ Testing commit 9028e00 with merge 96b9fb0...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 18, 2024
…nishearth

Clippy subtree update

r? `@Manishearth`
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling rustc_monomorphize v0.0.0 (/checkout/compiler/rustc_monomorphize)
   Compiling rustc_query_impl v0.0.0 (/checkout/compiler/rustc_query_impl)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/compiler/rustc_ast_lowering)
   Compiling rustc_smir v0.0.0 (/checkout/compiler/rustc_smir)
##[error]The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.

Session terminated, killing shell...::group::Clock drift check
  local time:  ...killed.
##[error]The operation was canceled.

@bors
Copy link
Collaborator

bors commented Apr 19, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 19, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ce6f209): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.1% [-4.1%, -4.1%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.1% [-5.1%, -5.1%] 1
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.6% [-3.6%, -3.6%] 1
All ❌✅ (primary) 1.1% [1.1%, 1.1%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 677.567s -> 678.527s (0.14%)
Artifact size: 315.40 MiB -> 316.04 MiB (0.21%)

@matthiaskrgr
Copy link
Member

@bors retry

@bors bors 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 Apr 19, 2024
@bors
Copy link
Collaborator

bors commented Apr 19, 2024

⌛ Testing commit 9028e00 with merge c4f112a...

@bors
Copy link
Collaborator

bors commented Apr 19, 2024

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing c4f112a to master...

1 similar comment
@bors
Copy link
Collaborator

bors commented Apr 19, 2024

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing c4f112a to master...

@bors bors merged commit c4f112a into rust-lang:master Apr 19, 2024
13 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 19, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c4f112a): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.0% [-2.0%, -2.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.0% [-2.0%, -2.0%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 672.871s -> 671.432s (-0.21%)
Artifact size: 315.31 MiB -> 315.27 MiB (-0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.