diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-08-19 12:26:41 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-19 12:26:41 +0530 |
| commit | c4707ff8ef8b1a8810afd3fbca91043600b934a0 (patch) | |
| tree | 0c68719478fcea3414cbeb72884d72ce43b3acbc /compiler/rustc_codegen_ssa/src | |
| parent | 2fe29753912a1be758a56453eaa80ddbe745300a (diff) | |
| parent | 3c8563abcf91eda340aa77d238954dd00fa0cb34 (diff) | |
| download | rust-c4707ff8ef8b1a8810afd3fbca91043600b934a0.tar.gz rust-c4707ff8ef8b1a8810afd3fbca91043600b934a0.zip | |
Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkov
make NOP dyn casts not require anything about the vtable As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/base.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index a840b270974..4c6be3f9108 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -151,6 +151,7 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( let old_info = old_info.expect("unsized_info: missing old info for trait upcasting coercion"); if data_a.principal_def_id() == data_b.principal_def_id() { + // A NOP cast that doesn't actually change anything, should be allowed even with invalid vtables. return old_info; } |
