rust/tests/ui/crashes
bors 8253040b3f Auto merge of #12591 - y21:issue12585, r=Jarcho
type certainty: clear `DefId` when an expression's type changes to non-adt

Fixes #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:

97ba291d5a/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):
97ba291d5a/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 #11135, does this change make sense to you?

changelog: none
2024-04-04 22:17:50 +00:00
..
auxiliary
third-party
associated-constant-ice.rs
cc_seme.rs
enum-glob-import-crate.rs
ice_exact_size.rs
ice-360.rs
ice-360.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-700.rs
ice-1588.rs
ice-1782.rs Add ui test for missing_transmute_annotations 2024-03-24 00:47:59 +01:00
ice-1969.rs
ice-2499.rs
ice-2594.rs
ice-2727.rs
ice-2760.rs
ice-2774.fixed
ice-2774.rs
ice-2774.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-2862.rs
ice-2865.rs
ice-3151.rs
ice-3462.rs
ice-3717.fixed
ice-3717.rs
ice-3717.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-3741.rs
ice-3747.rs
ice-3891.rs
ice-3891.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-3969.rs
ice-3969.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-4121.rs
ice-4545.rs
ice-4579.rs
ice-4671.rs
ice-4727.rs
ice-4760.rs Allow newly added non_local_definitions lint in clippy 2024-02-17 13:59:45 +01:00
ice-4775.rs
ice-4968.rs
ice-5207.rs
ice-5223.rs
ice-5238.rs
ice-5389.rs
ice-5497.rs
ice-5497.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-5579.rs
ice-5835.fixed
ice-5835.rs
ice-5835.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-5872.fixed
ice-5872.rs
ice-5872.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-5944.rs
ice-6139.rs
ice-6153.rs
ice-6179.rs Update (doc) comments 2024-03-22 06:31:51 +01:00
ice-6250.rs
ice-6250.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-6251.rs
ice-6251.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-6252.rs
ice-6252.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-6254.rs
ice-6255.rs Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-6255.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-6256.rs
ice-6256.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-6332.rs
ice-6539.rs
ice-6792.rs
ice-6793.rs
ice-6840.rs
ice-7012.rs
ice-7126.rs
ice-7169.fixed
ice-7169.rs
ice-7169.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-7231.rs
ice-7272.rs
ice-7340.rs
ice-7410.rs
ice-7423.rs
ice-7868.rs
ice-7868.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-7869.rs
ice-7869.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-7934.rs
ice-8250.fixed
ice-8250.rs
ice-8250.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-8386.rs
ice-8681.rs
ice-8821.rs
ice-8850.fixed
ice-8850.rs
ice-8850.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-9041.rs
ice-9041.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-9238.rs
ice-9242.rs
ice-9405.rs
ice-9405.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-9414.rs
ice-9445.rs
ice-9445.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-9459.rs
ice-9463.rs
ice-9463.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-9625.rs
ice-9746.rs
ice-10148.rs
ice-10148.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-10645.rs
ice-10645.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-10912.rs Use LitKind::Err for floats with empty exponents. 2024-02-28 20:59:27 +11:00
ice-10912.stderr Use LitKind::Err for floats with empty exponents. 2024-02-28 20:59:27 +11:00
ice-11065.rs Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-11230.rs
ice-11337.rs
ice-11422.fixed
ice-11422.rs
ice-11422.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-11755.rs
ice-11803.rs
ice-11803.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-11939.rs
ice-12253.rs Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-12491.fixed Merge commit '9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3' into clippy-subtree-update 2024-03-21 22:20:40 +01:00
ice-12491.rs Merge commit '9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3' into clippy-subtree-update 2024-03-21 22:20:40 +01:00
ice-12491.stderr Merge commit '9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3' into clippy-subtree-update 2024-03-21 22:20:40 +01:00
ice-12585.rs clear DefId when an expression's type changes to non-adt 2024-03-29 16:24:07 +01:00
ice-12616.fixed avoid an ICE in ptr_as_ptr when getting the def_id of a local 2024-04-02 15:09:32 +02:00
ice-12616.rs avoid an ICE in ptr_as_ptr when getting the def_id of a local 2024-04-02 15:09:32 +02:00
ice-12616.stderr avoid an ICE in ptr_as_ptr when getting the def_id of a local 2024-04-02 15:09:32 +02:00
ice-96721.fixed
ice-96721.rs
ice-96721.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
ice-rust-107877.rs
if_same_then_else.rs
implements-trait.rs
inherent_impl.rs
issue-825.rs
issues_loop_mut_cond.rs
match_same_arms_const.rs
mut_mut_macro.rs
needless_borrow_fp.rs
needless_lifetimes_impl_trait.fixed
needless_lifetimes_impl_trait.rs
needless_lifetimes_impl_trait.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
needless_pass_by_value-w-late-bound.fixed
needless_pass_by_value-w-late-bound.rs
needless_pass_by_value-w-late-bound.stderr Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
regressions.rs
returns.rs
shadow.rs
single-match-else.rs
trivial_bounds.rs
unreachable-array-or-slice.rs Merge commit '93f0a9a91f58c9b2153868f458402155fb6265bb' into clippy-subtree-update 2024-03-07 17:19:29 +01:00
unreachable-array-or-slice.stderr Overhaul how stashed diagnostics work, again. 2024-02-29 11:08:27 +11:00
used_underscore_binding_macro.rs