From d0c51412572b3b7adc4896224a745c01fe53f4ed Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:56:37 +0000 Subject: [PATCH] Rustup to rustc 1.79.0-nightly (fb898629a 2024-04-21) --- rust-toolchain | 2 +- src/base.rs | 2 +- src/value_and_place.rs | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/rust-toolchain b/rust-toolchain index bf66aeae18b..1fc08a92fe8 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-04-20" +channel = "nightly-2024-04-22" components = ["rust-src", "rustc-dev", "llvm-tools"] diff --git a/src/base.rs b/src/base.rs index 4892d46a572..4c53a9db7bd 100644 --- a/src/base.rs +++ b/src/base.rs @@ -825,7 +825,7 @@ fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool { }; let data = codegen_operand(fx, data); let meta = codegen_operand(fx, meta); - let ptr_val = CValue::pointer_from_data_and_meta(data, meta, layout); + let ptr_val = CValue::pointer_from_data_and_meta(fx, data, meta, layout); lval.write_cvalue(fx, ptr_val); } Rvalue::Aggregate(ref kind, ref operands) => { diff --git a/src/value_and_place.rs b/src/value_and_place.rs index 38fedb6036c..eeae98ed04d 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -99,17 +99,18 @@ pub(crate) fn by_val_pair( /// /// Panics if the `layout` is not a raw pointer. pub(crate) fn pointer_from_data_and_meta( + fx: &mut FunctionCx<'_, '_, 'tcx>, data: CValue<'tcx>, meta: CValue<'tcx>, layout: TyAndLayout<'tcx>, ) -> CValue<'tcx> { + assert!(data.layout().ty.is_unsafe_ptr()); assert!(layout.ty.is_unsafe_ptr()); - let inner = match (data.0, meta.0) { - (CValueInner::ByVal(p), CValueInner::ByVal(m)) => CValueInner::ByValPair(p, m), - (p @ CValueInner::ByVal(_), CValueInner::ByRef(..)) if meta.1.is_zst() => p, - _ => bug!("RawPtr operands {data:?} {meta:?}"), - }; - CValue(inner, layout) + if meta.layout().is_zst() { + data.cast_pointer_to(layout) + } else { + CValue::by_val_pair(data.load_scalar(fx), meta.load_scalar(fx), layout) + } } pub(crate) fn layout(&self) -> TyAndLayout<'tcx> {