diff options
| author | Gary Guo <gary@garyguo.net> | 2021-09-06 18:33:23 +0100 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2021-09-25 01:08:41 +0100 |
| commit | c38da2e0a322908ba4b1d4b7e59c5da0531af4e1 (patch) | |
| tree | cd26f185c4302d0389f8703ea0d2b76cfa1ac4ba /compiler/rustc_codegen_cranelift/src | |
| parent | 308dffd25cb55bbb4a1fbee9822cf82c6a5d012d (diff) | |
| download | rust-c38da2e0a322908ba4b1d4b7e59c5da0531af4e1.tar.gz rust-c38da2e0a322908ba4b1d4b7e59c5da0531af4e1.zip | |
Introduce `Rvalue::ShallowInitBox`
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/base.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index d8fa2c76904..1b30edd2938 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -701,6 +701,13 @@ fn codegen_stmt<'tcx>( let len = codegen_array_len(fx, place); lval.write_cvalue(fx, CValue::by_val(len, usize_layout)); } + Rvalue::ShallowInitBox(ref operand, content_ty) => { + let content_ty = fx.monomorphize(content_ty); + let box_layout = fx.layout_of(fx.tcx.mk_box(content_ty)); + let operand = codegen_operand(fx, operand); + let operand = operand.load_scalar(fx); + lval.write_cvalue(fx, CValue::by_val(operand, box_layout)); + } Rvalue::NullaryOp(NullOp::Box, content_ty) => { let usize_type = fx.clif_type(fx.tcx.types.usize).unwrap(); let content_ty = fx.monomorphize(content_ty); |
