Skip to content

Commit d0c5141

Browse files
committed
Rustup to rustc 1.79.0-nightly (fb898629a 2024-04-21)
1 parent 8bc15fb commit d0c5141

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-04-20"
2+
channel = "nightly-2024-04-22"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]

src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ fn codegen_stmt<'tcx>(
825825
};
826826
let data = codegen_operand(fx, data);
827827
let meta = codegen_operand(fx, meta);
828-
let ptr_val = CValue::pointer_from_data_and_meta(data, meta, layout);
828+
let ptr_val = CValue::pointer_from_data_and_meta(fx, data, meta, layout);
829829
lval.write_cvalue(fx, ptr_val);
830830
}
831831
Rvalue::Aggregate(ref kind, ref operands) => {

src/value_and_place.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,18 @@ impl<'tcx> CValue<'tcx> {
9999
///
100100
/// Panics if the `layout` is not a raw pointer.
101101
pub(crate) fn pointer_from_data_and_meta(
102+
fx: &mut FunctionCx<'_, '_, 'tcx>,
102103
data: CValue<'tcx>,
103104
meta: CValue<'tcx>,
104105
layout: TyAndLayout<'tcx>,
105106
) -> CValue<'tcx> {
107+
assert!(data.layout().ty.is_unsafe_ptr());
106108
assert!(layout.ty.is_unsafe_ptr());
107-
let inner = match (data.0, meta.0) {
108-
(CValueInner::ByVal(p), CValueInner::ByVal(m)) => CValueInner::ByValPair(p, m),
109-
(p @ CValueInner::ByVal(_), CValueInner::ByRef(..)) if meta.1.is_zst() => p,
110-
_ => bug!("RawPtr operands {data:?} {meta:?}"),
111-
};
112-
CValue(inner, layout)
109+
if meta.layout().is_zst() {
110+
data.cast_pointer_to(layout)
111+
} else {
112+
CValue::by_val_pair(data.load_scalar(fx), meta.load_scalar(fx), layout)
113+
}
113114
}
114115

115116
pub(crate) fn layout(&self) -> TyAndLayout<'tcx> {

0 commit comments

Comments
 (0)