diff options
| author | Ralf Jung <post@ralfj.de> | 2023-09-15 15:59:47 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-09-19 20:17:43 +0200 |
| commit | ea22adbabdd0f5fbc033101eaeed6d3e304ede08 (patch) | |
| tree | 9977ba50327f6e04a3752f9a84d6f5110454b3ad /compiler/rustc_codegen_ssa/src/mir | |
| parent | 0692db1a9082380e027f354912229dfd6af37e78 (diff) | |
| download | rust-ea22adbabdd0f5fbc033101eaeed6d3e304ede08.tar.gz rust-ea22adbabdd0f5fbc033101eaeed6d3e304ede08.zip | |
adjust constValue::Slice to work for arbitrary slice types
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/operand.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 926a0bed0da..9205acc527e 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -100,15 +100,12 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { OperandValue::Immediate(llval) } ConstValue::ZeroSized => return OperandRef::zero_sized(layout), - ConstValue::Slice { data, start, end } => { + ConstValue::Slice { data, meta } => { let Abi::ScalarPair(a_scalar, _) = layout.abi else { bug!("from_const: invalid ScalarPair layout: {:#?}", layout); }; let a = Scalar::from_pointer( - Pointer::new( - bx.tcx().reserve_and_set_memory_alloc(data), - Size::from_bytes(start), - ), + Pointer::new(bx.tcx().reserve_and_set_memory_alloc(data), Size::ZERO), &bx.tcx(), ); let a_llval = bx.scalar_to_backend( @@ -116,7 +113,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { a_scalar, bx.scalar_pair_element_backend_type(layout, 0, true), ); - let b_llval = bx.const_usize((end - start) as u64); + let b_llval = bx.const_usize(meta); OperandValue::Pair(a_llval, b_llval) } ConstValue::Indirect { alloc_id, offset } => { |
