Skip to content

Commit 8db5ad1

Browse files
committed
fix slice wide ptr metadata
1 parent 61b001f commit 8db5ad1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/what-unsafe-does.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ language cares about is preventing the following things:
2929
* a null `fn` pointer
3030
* a `char` outside the ranges [0x0, 0xD7FF] and [0xE000, 0x10FFFF]
3131
* a `!` (all values are invalid for this type)
32+
* an integer (`i*`/`u*`), floating point value (`f*`), or raw pointer read from
33+
[uninitialized memory][]
3234
* a reference/`Box` that is dangling, unaligned, or points to an invalid value.
3335
* a wide reference, `Box`, or raw pointer that has invalid metadata:
34-
* slice metadata is invalid if the slice has a total size larger than
35-
`isize::MAX` bytes in memory
3636
* `dyn Trait` metadata is invalid if it is not a pointer to a vtable for
3737
`Trait` that matches the actual dynamic trait the reference points to
38+
* slice metadata is invalid if the length is not a valid `usize`
39+
(i.e., it must not be read from uninitialized memory)
3840
* a `str` that isn't valid UTF-8
39-
* an integer (`i*`/`u*`), floating point value (`f*`), or raw pointer read from
40-
[uninitialized memory][]
4141
* a type with custom invalid values that is one of those values, such as a
4242
`NonNull` that is null. (Requesting custom invalid values is an unstable
4343
feature, but some stable libstd types, like `NonNull`, make use of it.)

0 commit comments

Comments
 (0)