Skip to content
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

[beta] Clippy backports for ICE fixes #114937

Merged
merged 8 commits into from
Aug 17, 2023
Merged

Conversation

…sery, r=xFrednet

Move tuple_array_conversions to nursery

changelog: Move [`tuple_array_conversions`] to `nursery` (Now allow-by-default)
<!-- FIY: Ignore this change, if the commit gets backported and also rust-lang/rust-clippy#11146 -->
[rust-lang#11172](rust-lang/rust-clippy#11172)

The nursery change got lost in rust-lang#11146 and it ended up in pedantic, this puts it in nursery and gives something to backport

r? `@xFrednet`
[`arc_with_non_send_sync`]: don't lint if type has nested type parameters

Fixes rust-lang#11076

changelog: [`arc_with_non_send_sync`]: don't lint if type has nested type parameters

r? `@Manishearth`
…entri3

`arc_with_non_send_sync`: reword and move to `suspicious`

Fixes rust-lang#11079

changelog: [`arc_with_non_send_sync`]: move to complexity
…ice, r=llogiq

redundant_type_annotations: only pass certain def kinds to type_of

Fixes rust-lang#11190
Fixes rust-lang#113516

Also adds an `is_lint_allowed` check to skip the lint when it's not needed

changelog: none
Fix ICE in rust-lang#10535

Fixes rust-lang#10535

r? `@Jarcho`

changelog: Eliminate ICE described in rust-lang#10535
[`unnecessary_literal_unwrap`]: Fix ICE on None.unwrap_or_default()

Fixes rust-lang#11099
Fixes rust-lang#11064

I'm running into rust-lang#11099 (cc `@y21)` on my Rust codebase. Clippy ICEs on this code when evaluating the `unnecessary_literal_unwrap` lint:
```rust
fn main() {
    let val1: u8 = None.unwrap_or_default();
}
```

This fixes that ICE and adds an message specifically for that case:

```
error: used `unwrap_or_default()` on `None` value
  --> $DIR/unnecessary_literal_unwrap.rs:26:5
   |
LL |     None::<String>.unwrap_or_default();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap_or_default()`: `String::default()`
```

This PR also fixes the same ICE with `None.unwrap_or_else` (by giving the generic error message for the lint in that case).

changelog: Fix ICE in `unnecessary_literal_unwrap` on `None.unwrap_or_default()`
[`useless_conversion`]: only lint on paths to fn items and fix FP in macro

Fixes rust-lang#11065 (which is actually two issues: an ICE and a false positive)

It now makes sure that the function call path points to a function-like item (and not e.g. a `const` like in the linked issue), so that calling `TyCtxt::fn_sig` later in the lint does not ICE (fixes rust-lang/rust-clippy#11065 (comment)).
It *also* makes sure that the expression is not part of a macro call (fixes rust-lang/rust-clippy#11065 (comment)). ~~I'm not sure if there's a better way to check this other than to walk the parent expr chain and see if any of them are expansions.~~ (edit: it doesn't do this anymore)

changelog: [`useless_conversion`]: fix ICE when call receiver is a non-fn item
changelog: [`useless_conversion`]: don't lint if argument is a macro argument (fixes a FP)

r? `@llogiq` (reviewed rust-lang#10814, which introduced these issues)
[`missing_fields_in_debug`]: make sure self type is an adt

Fixes rust-lang#11063, another ICE that can only happen in core.

This lint needs the `DefId` of the implementor to get its fields, but that ICEs if the implementor does not have a `DefId` (as is the case with primitive types, e.g. `impl Debug for bool`), which is where this ICE comes from.

This PR changes the check I added in rust-lang#10897 to be more... robust against `Debug` implementations we don't want to lint.
Instead of just checking if the self type is a type parameter and "special casing" one specific case we don't want to lint, we should probably rather just check that the self type is either a struct, an enum or a union and only then continue.
That prevents weird edge cases like this one that can only happen in core.

Again, I don't know if it's even possible to add a test case for this since one cannot implement `Debug` for primitive types outside of the crate that defined `Debug` (core).
I did make sure that this PR no longer ICEs on `impl<T> Debug for T` and `impl Debug for bool`.
Maybe writing such a test is possible with `#![no_core]` and then re-defining the `Debug` trait or something like that...?

changelog: [`missing_fields_in_debug`]: make sure self type is an adt (fixes an ICE in core)

r? `@Alexendoo` (reviewed the last PRs for this lint)
@rustbot
Copy link
Collaborator

rustbot commented Aug 17, 2023

⚠️ Warning ⚠️

  • Pull requests are usually filed against the master branch for this repo, but this one is against beta. Please double check that you specified the right target!

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 17, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 17, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Mark-Simulacrum
Copy link
Member

@bors r+ rollup=never p=1

@bors
Copy link
Contributor

bors commented Aug 17, 2023

📌 Commit 48fca12 has been approved by Mark-Simulacrum

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 Aug 17, 2023
@bors
Copy link
Contributor

bors commented Aug 17, 2023

⌛ Testing commit 48fca12 with merge 82e6312e609698e0c711e728b7cf33aa09daa1b2...

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#9 DONE 28.7s

#10 [ 6/27] RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
#10 0.330 Warning: apt-key output should not be parsed (stdout is not a terminal)
#10 0.341 Executing: /tmp/apt-key-gpghome.F2LzJjulOV/gpg.1.sh --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
#10 1.346 gpg: Total number processed: 1
#10 1.346 gpg:               imported: 1
#10 DONE 1.4s

---
------
Dockerfile:88
--------------------
  86 |     RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  pc
  87 |     # Build deprecated target 'x86_64-sun-solaris2.10' until removed
  88 | >>> RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun
  90 |     COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
--------------------
ERROR: failed to solve: process "/bin/sh -c /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun" did not complete successfully: exit code: 2
Command failed. Attempt 2/5:
---
------
Dockerfile:88
--------------------
  86 |     RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  pc
  87 |     # Build deprecated target 'x86_64-sun-solaris2.10' until removed
  88 | >>> RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun
  90 |     COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
--------------------
ERROR: failed to solve: process "/bin/sh -c /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun" did not complete successfully: exit code: 2
Command failed. Attempt 3/5:
---
------
Dockerfile:88
--------------------
  86 |     RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  pc
  87 |     # Build deprecated target 'x86_64-sun-solaris2.10' until removed
  88 | >>> RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun
  90 |     COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
--------------------
ERROR: failed to solve: process "/bin/sh -c /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun" did not complete successfully: exit code: 2
Command failed. Attempt 4/5:
---
------
Dockerfile:88
--------------------
  86 |     RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  pc
  87 |     # Build deprecated target 'x86_64-sun-solaris2.10' until removed
  88 | >>> RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun
  90 |     COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
--------------------
ERROR: failed to solve: process "/bin/sh -c /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun" did not complete successfully: exit code: 2
Command failed. Attempt 5/5:
---
------
Dockerfile:88
--------------------
  86 |     RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  pc
  87 |     # Build deprecated target 'x86_64-sun-solaris2.10' until removed
  88 | >>> RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun
  90 |     COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
--------------------
ERROR: failed to solve: process "/bin/sh -c /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  sun" did not complete successfully: exit code: 2
The command has failed after 5 attempts.

@bors
Copy link
Contributor

bors commented Aug 17, 2023

💔 Test failed - checks-actions

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 17, 2023
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 17, 2023
@matthiaskrgr
Copy link
Member

@bors r=Mark-Simulacrum
looks spurious

@bors
Copy link
Contributor

bors commented Aug 17, 2023

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Aug 17, 2023

📌 Commit 48fca12 has been approved by Mark-Simulacrum

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 Aug 17, 2023
@bors
Copy link
Contributor

bors commented Aug 17, 2023

⌛ Testing commit 48fca12 with merge 8c60295...

@bors
Copy link
Contributor

bors commented Aug 17, 2023

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 8c60295 to beta...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 17, 2023
@bors bors merged commit 8c60295 into rust-lang:beta Aug 17, 2023
12 checks passed
@rustbot rustbot added this to the 1.72.0 milestone Aug 17, 2023
@flip1995 flip1995 deleted the clippy_beta_backport branch August 17, 2023 23:16
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 18, 2023
…krgr

Clippy backport

r? `@Manishearth`

This is the accompanying PR to rust-lang#114937. This needs to be merged before tomorrow, so that it gets into master, before beta is branched.

The second commit is pretty much an out-of cycle sync, so that we don't get backport-debt for next release cycle right away.

cc `@Mark-Simulacrum` also mentioning you here, to make sure this is included in the beta branching.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 21, 2023
Clippy backport

r? `@Manishearth`

This is the accompanying PR to rust-lang/rust#114937. This needs to be merged before tomorrow, so that it gets into master, before beta is branched.

The second commit is pretty much an out-of cycle sync, so that we don't get backport-debt for next release cycle right away.

cc `@Mark-Simulacrum` also mentioning you here, to make sure this is included in the beta branching.
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.

None yet

6 participants