Skip to content

Commit 0e15610

Browse files
committed
refactor PointeeInfo
Make `size`/`align` always correct rather than conditionally on the `safe` field. This makes it less error prone and easier to work with for `MaybeDangling` / potential future pointer kinds like `Aligned<_>`.
1 parent 1b01acd commit 0e15610

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/type_of.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,10 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
288288
Float(f) => cx.type_from_float(f),
289289
Pointer(address_space) => {
290290
// If we know the alignment, pick something better than i8.
291-
let pointee = if let Some(pointee) = self.pointee_info_at(cx, offset) {
292-
cx.type_pointee_for_align(pointee.align)
291+
let pointee = if let Some(pointee) = self.pointee_info_at(cx, offset)
292+
&& let Some(align) = pointee.align
293+
{
294+
cx.type_pointee_for_align(align)
293295
} else {
294296
cx.type_i8()
295297
};

0 commit comments

Comments
 (0)