Skip to content

Commit

Permalink
typo fix and clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 19, 2024
1 parent c03759e commit 4f5888f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/behavior-considered-undefined.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ Please read the [Rustonomicon] before writing unsafe code.
* A `!` (all values are invalid for this type).
* An integer (`i*`/`u*`), floating point value (`f*`), or raw pointer obtained
from [uninitialized memory][undef], or uninitialized memory in a `str`.
* A reference or `Box<T>` that is [dangling], misaligned, or points to an invalid value.
* A reference or `Box<T>` that is [dangling], misaligned, or points to an invalid value
(in case of dynamically sized types, using the actual dynamic type of the
pointee as determined by the metadata).
* Invalid metadata in a wide reference, `Box<T>`, or raw pointer. The requirement
for the metadata is determined by the type of the unsized tail:
* `dyn Trait` metadata is invalid if it is not a pointer to a vtable for
`Trait` that matches the actual dynamic trait the pointer or reference points to.
* Slice metadata is invalid if the length is not a valid `usize`
* `dyn Trait` metadata is invalid if it is not a pointer to a vtable for `Trait`.
* Slice (`[T]`) metadata is invalid if the length is not a valid `usize`
(i.e., it must not be read from uninitialized memory).
Furthermore, for wide references and `Box<T>`, slice metadata is invalid
if it makes the total size of the pointed-to value bigger than `isize::MAX`.
Expand Down

0 comments on commit 4f5888f

Please sign in to comment.