Commit Graph

8 Commits

Author SHA1 Message Date
Nilstrieb b6657a8ad4 Never consider raw pointer casts to be trival
HIR typeck tries to figure out which casts are trivial by doing them as
coercions and seeing whether this works. Since HIR typeck is oblivious
of lifetimes, this doesn't work for pointer casts that only change the
lifetime of the pointee, which are, as borrowck will tell you, not
trivial.

This change makes it so that raw pointer casts are never considered
trivial.

This also incidentally fixes the "trivial cast" lint false positive on
the same code. Unfortunately, "trivial cast" lints are now never emitted
on raw pointer casts, even if they truly are trivial. This could be
fixed by also doing the lint in borrowck for raw pointers specifically.
2023-10-25 23:15:18 +02:00
Camille GILLOT d8cffda66a FileCheck casts. 2023-10-19 15:51:54 +00:00
Camille GILLOT 68c409f8f6 FileCheck combine_transmutes. 2023-10-19 15:51:54 +00:00
Camille GILLOT 386fff34f7 FileCheck duplicate_switch_targets. 2023-10-19 15:51:54 +00:00
Camille GILLOT f856247cc9 FileCheck intrinsic_asserts. 2023-10-19 15:51:54 +00:00
Camille GILLOT ddc328c2f1 FileCheck combine_clone_of_primitives. 2023-10-19 15:51:54 +00:00
Camille GILLOT 5453a4f056 FileCheck bool_compare. 2023-10-19 15:51:53 +00:00
Camille GILLOT f0690d5232 FileCheck combine_array_len. 2023-10-19 15:51:53 +00:00