-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[beta] Clippy backports for ICE fixes #114937
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
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)
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
@bors r+ rollup=never p=1 |
⌛ Testing commit 48fca12 with merge 82e6312e609698e0c711e728b7cf33aa09daa1b2... |
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors r=Mark-Simulacrum |
💡 This pull request was already approved, no need to approve it again.
|
☀️ Test successful - checks-actions |
…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.
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.
This backports PRs to beta, that fix ICEs, some lint grouping and FP fixes. Namely:
unnecessary_literal_unwrap
]: Fix ICE on None.unwrap_or_default() rust-clippy#11106arc_with_non_send_sync
: reword and move tosuspicious
rust-clippy#11104arc_with_non_send_sync
]: don't lint if type has nested type parameters rust-clippy#11077useless_conversion
]: only lint on paths to fn items and fix FP in macro rust-clippy#11070 (This PR is not synced to the Rust repo yet, but I will open a separate PR to get it intomaster
, before beta is branched: Clippy backport #114938)missing_fields_in_debug
]: make sure self type is an adt rust-clippy#11069Kind of a big backport, but most of it is tests.
r? @Mark-Simulacrum
cc @Manishearth