about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-03 10:02:52 +0000
committerbors <bors@rust-lang.org>2023-10-03 10:02:52 +0000
commiteb0f3ed59c6508a37c6598bc9762987f053993a7 (patch)
tree96ad3accf1316b08d9ecf9bffa50d3dd73f4b630 /compiler/rustc_codegen_ssa
parent9998f4add08c3d09c82e00975cf3a293b30160ec (diff)
parent5d753abb300eebfb6492dc2b47bd32052a322b71 (diff)
downloadrust-eb0f3ed59c6508a37c6598bc9762987f053993a7.tar.gz
rust-eb0f3ed59c6508a37c6598bc9762987f053993a7.zip
Auto merge of #115025 - ouz-a:ouz_testing, r=lcnr
Make subtyping explicit in MIR

This adds new mir-opt that pushes new `ProjectionElem` called `ProjectionElem::Subtype(T)` to `Rvalue` of a subtyped assignment so we can unsoundness issues like https://github.com/rust-lang/rust/issues/107205

Addresses https://github.com/rust-lang/rust/issues/112651

r? `@lcnr`
Diffstat (limited to 'compiler/rustc_codegen_ssa')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/place.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs
index f775711f870..eb590a45a63 100644
--- a/compiler/rustc_codegen_ssa/src/mir/place.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/place.rs
@@ -466,6 +466,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 mir::ProjectionElem::OpaqueCast(ty) => {
                     bug!("encountered OpaqueCast({ty}) in codegen")
                 }
+                mir::ProjectionElem::Subtype(ty) => cg_base.project_type(bx, self.monomorphize(ty)),
                 mir::ProjectionElem::Index(index) => {
                     let index = &mir::Operand::Copy(mir::Place::from(index));
                     let index = self.codegen_operand(bx, index);