You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#158666 - scottmcm:scalar-but-packed, r=workingjubilee
Carry the `b_offset` inside `BackendRepr::ScalarPair`
Inspired by rust-lang/compiler-team#1007 but doesn't actually change any of the layout rules just yet.
This turned out to be a nice change even if we didn't use the extra flexibility, IMHO, because it allowed so many things like
```diff
@@ -222,12 +224,12 @@ fn from_const_alloc<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
let val = read_scalar(offset, size, s, bx.immediate_backend_type(layout));
OperandRef { val: OperandValue::Immediate(val), layout, move_annotation: None }
}
- BackendRepr::ScalarPair(
- a @ abi::Scalar::Initialized { .. },
- b @ abi::Scalar::Initialized { .. },
- ) => {
+ BackendRepr::ScalarPair {
+ a: a @ abi::Scalar::Initialized { .. },
+ b: b @ abi::Scalar::Initialized { .. },
+ b_offset,
+ } => {
let (a_size, b_size) = (a.size(bx), b.size(bx));
- let b_offset = (offset + a_size).align_to(b.default_align(bx).abi);
assert!(b_offset.bytes() > 0);
let a_val = read_scalar(
offset,
```
as *oh my* was that little magic incantation copy-pasted all over the place.
Apologies for the pretty-giant PR. I tried to make it as direct a change as I could: if it was `(..)` before it's `{ .. }` now, if it was `(_, _)` before it's `{ a: _, b: _, b_offset: _ }` now. I kept the names the same so the code lines were unchanged even if normally I might have just renamed things, etc. I'll add some inline notes for places of particular interest.
r? @workingjubilee
0 commit comments