about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-09-25 20:10:58 +0200
committerGitHub <noreply@github.com>2024-09-25 20:10:58 +0200
commit0055895c307b1018b04c07a7b379446e6b57acb8 (patch)
tree2ecfeff9e6cc18c7bb4f3988c6b864a2451db053 /compiler/rustc_codegen_llvm/src
parentb5117538e934f81e39eb9c326fdcc6574d144cb7 (diff)
parent3209943604a9b3565a3cef4c43b567f65cfdf192 (diff)
downloadrust-0055895c307b1018b04c07a7b379446e6b57acb8.tar.gz
rust-0055895c307b1018b04c07a7b379446e6b57acb8.zip
Rollup merge of #130735 - compiler-errors:validate-unsize, r=spastorino,RalfJung
Simple validation for unsize coercion in MIR validation

This adds the most basic validity check to unsize coercions in MIR. The src and target of an unsize cast must *at least* implement `Src: CoerceUnsized<Target>` for this to be valid.

This doesn't the second, more subtle validity check that is taken of advantage in codegen [here](https://github.com/rust-lang/rust/blob/914193c8f40528fe82696e1054828de8c399882e/compiler/rustc_codegen_ssa/src/base.rs#L126), but I did leave a beefy FIXME for that explaining what it is.

As a consequence, this also fixes an ICE with GVN and invalid unsize coercions. This is somewhat coincidental, since MIR inlining will check that a body is valid before inlining it; so now that we determine it to be invalid, we don't inline it, and we don't encounter the GVN ICE. I'm not certain if the same GVN ICE is triggerable without the inliner, and perhaps instead with trivial where clauses or something.

cc `@RalfJung`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions