rust/tests/ui/cast
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
..
cast-as-bool.rs
cast-as-bool.stderr
cast-char.rs
cast-char.stderr
cast-does-fallback.rs
cast-errors-issue-43825.rs
cast-errors-issue-43825.stderr
cast-from-nil.rs
cast-from-nil.stderr
cast-int-to-char.rs
cast-int-to-char.stderr
cast-macro-lhs.rs
cast-macro-lhs.stderr
cast-pointee-projection.rs
cast-region-to-uint.rs
cast-rfc0401-2.rs
cast-rfc0401-2.stderr
cast-rfc0401-vtable-kinds.rs
cast-rfc0401.rs
cast-to-bare-fn.rs
cast-to-bare-fn.stderr
cast-to-infer-ty.rs
cast-to-nil.rs
cast-to-nil.stderr
cast-to-unsized-trait-object-suggestion.rs
cast-to-unsized-trait-object-suggestion.stderr
cast.rs
casts-differing-anon.rs
casts-differing-anon.stderr
casts-issue-46365.rs
casts-issue-46365.stderr
codegen-object-shim.rs
fat-ptr-cast-rpass.rs
fat-ptr-cast.rs
fat-ptr-cast.stderr
issue-10991.rs
issue-10991.stderr
issue-17444.rs
issue-17444.stderr
issue-84213.fixed
issue-84213.rs
issue-84213.stderr
issue-85586.rs
issue-85586.stderr
issue-88621.rs
issue-88621.stderr
issue-89497.fixed
issue-89497.rs
issue-89497.stderr
issue-106883-is-empty.rs
issue-106883-is-empty.stderr
ptr-to-ptr-different-regions.rs
supported-cast.rs
unsized-struct-cast.rs
unsized-struct-cast.stderr
unsupported-cast.rs
unsupported-cast.stderr