Skip to content

Commit 6c3e762

Browse files
committed
Layout.PointeeInfo
1 parent ef024e1 commit 6c3e762

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/librustc/ty/layout.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,8 +2205,7 @@ where
22052205
ty::RawPtr(mt) if offset.bytes() == 0 => {
22062206
cx.layout_of(mt.ty).to_result().ok()
22072207
.map(|layout| PointeeInfo {
2208-
size: layout.pref_pos.size,
2209-
align: layout.pref_pos.align.abi,
2208+
mem_pos: layout.pref_pos.mem_pos(),
22102209
safe: None,
22112210
})
22122211
}
@@ -2244,8 +2243,7 @@ where
22442243

22452244
cx.layout_of(ty).to_result().ok()
22462245
.map(|layout| PointeeInfo {
2247-
size: layout.pref_pos.size,
2248-
align: layout.pref_pos.align.abi,
2246+
mem_pos: layout.pref_pos.mem_pos(),
22492247
safe: Some(kind),
22502248
})
22512249
}
@@ -2681,8 +2679,8 @@ where
26812679

26822680
if let Some(pointee) = layout.pointee_info_at(cx, offset) {
26832681
if let Some(kind) = pointee.safe {
2684-
attrs.pointee_size = pointee.size;
2685-
attrs.pointee_align = Some(pointee.align);
2682+
attrs.pointee_size = pointee.mem_pos.size;
2683+
attrs.pointee_align = Some(pointee.mem_pos.align);
26862684

26872685
// `Box` pointer parameters never alias because ownership is transferred
26882686
// `&mut` pointer parameters never alias other parameters,

src/librustc_codegen_llvm/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> {
306306
layout::Pointer => {
307307
// If we know the alignment, pick something better than i8.
308308
let pointee = if let Some(pointee) = self.pointee_info_at(cx, offset) {
309-
cx.type_pointee_for_align(pointee.align)
309+
cx.type_pointee_for_align(pointee.mem_pos.align)
310310
} else {
311311
cx.type_i8()
312312
};

src/librustc_target/abi/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,8 +1282,7 @@ pub enum PointerKind {
12821282

12831283
#[derive(Copy, Clone)]
12841284
pub struct PointeeInfo {
1285-
pub size: Size,
1286-
pub align: Align,
1285+
pub mem_pos: MemoryPosition,
12871286
pub safe: Option<PointerKind>,
12881287
}
12891288

0 commit comments

Comments
 (0)