Skip to content

Commit

Permalink
Remove note about soundness hole in type-layout.md
Browse files Browse the repository at this point in the history
Issue rust-lang/rust#27060 has been resolved, so it is no longer possible to safely create unaligned pointers to packed struct fields.
  • Loading branch information
yjhn authored and hehaoqian committed Jul 1, 2023
1 parent 353e038 commit 04cddc0
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/type-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,7 @@ The `align` modifier can also be applied on an `enum`.
When it is, the effect on the `enum`'s alignment is the same as if the `enum`
was wrapped in a newtype `struct` with the same `align` modifier.

<div class="warning">

***Warning:*** Dereferencing an unaligned pointer is [undefined behavior] and
it is possible to [safely create unaligned pointers to `packed` fields][27060].
Like all ways to create undefined behavior in safe Rust, this is a bug.

</div>
Dereferencing an unaligned pointer is [undefined behavior].

### The `transparent` Representation

Expand Down

0 comments on commit 04cddc0

Please sign in to comment.