Skip to content

Commit 67540ec

Browse files
committed
Skip checks for common types with alignment 1
1 parent a71b808 commit 67540ec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_mir_transform/src/check_alignment.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ impl<'tcx, 'a> Visitor<'tcx> for PointerFinder<'tcx, 'a> {
9999
return;
100100
}
101101

102+
if [self.tcx.types.bool, self.tcx.types.i8, self.tcx.types.u8, self.tcx.types.str_]
103+
.contains(&pointee_ty)
104+
{
105+
debug!("Trivially aligned pointee type: {:?}", pointer_ty);
106+
return;
107+
}
108+
102109
self.pointers.push((pointer, pointee_ty))
103110
}
104111
}

0 commit comments

Comments
 (0)