diff options
| author | bors <bors@rust-lang.org> | 2022-10-13 03:33:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-13 03:33:40 +0000 |
| commit | 3cf5fc58d56adeee42abb7e5059c718b0a86857d (patch) | |
| tree | 82819af2de9e0f2863eb6ead3756f3350b81d351 /compiler/rustc_codegen_ssa/src | |
| parent | 2a9217601c0e5ae83fa8bca6797137a6d2f7e4e5 (diff) | |
| parent | e8029368d3ccba813cd1ed56a7cf5c0ab124f2f0 (diff) | |
| download | rust-3cf5fc58d56adeee42abb7e5059c718b0a86857d.tar.gz rust-3cf5fc58d56adeee42abb7e5059c718b0a86857d.zip | |
Auto merge of #102995 - JohnTitor:rollup-yomkwge, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #102641 (Support casting boxes to dyn*) - #102836 (rustc_target: Fix json target specs using LLD linker flavors in link args) - #102949 (should-skip-this: add missing backslash) - #102967 (Add test for issue 102964) - #102971 (tidy: error if a lang feature is already present) - #102974 (Fix small word dupe typos) - #102980 (rustdoc: merge separate `.item-info` CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/rvalue.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index abf3c9a363f..4ed99df1e81 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -14,6 +14,7 @@ use rustc_middle::ty::cast::{CastTy, IntTy}; use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf}; use rustc_middle::ty::{self, adjustment::PointerCast, Instance, Ty, TyCtxt}; use rustc_span::source_map::{Span, DUMMY_SP}; +use rustc_target::abi::Size; impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { #[instrument(level = "trace", skip(self, bx))] @@ -285,6 +286,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bug!("Only valid to do a DynStar cast into a DynStar type") }; let vtable = get_vtable(bx.cx(), source.ty(self.mir, bx.tcx()), trait_ref); + let vtable = bx.pointercast(vtable, bx.cx().type_ptr_to(bx.cx().type_isize())); + // FIXME(dyn-star): this is probably not the best way to check if this is + // a pointer, and really we should ensure that the value is a suitable + // pointer earlier in the compilation process. + let data = match operand.layout.pointee_info_at(bx.cx(), Size::ZERO) { + Some(_) => bx.ptrtoint(data, bx.cx().type_isize()), + None => data, + }; OperandValue::Pair(data, vtable) } mir::CastKind::Pointer( |
