Skip to content

Commit 78c2473

Browse files
committed
note on not-too-large slices
1 parent 8db5ad1 commit 78c2473

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/what-unsafe-does.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ points to are part of the same allocation (so in particular they all have to be
5050
part of *some* allocation). The span of bytes it points to is determined by the
5151
pointer value and the size of the pointee type. As a consequence, if the span is
5252
empty, "dangling" is the same as "non-null". Note that slices point to their
53-
entire range, so it's very important that the length metadata is never too
54-
large. If for some reason this is too cumbersome, consider using raw pointers.
53+
entire range, so it's very important that the length metadata is never too large
54+
(in particular, allocations and therefore slices cannot be bigger than
55+
`isize::MAX` bytes). If for some reason this is too cumbersome, consider using
56+
raw pointers.
5557

5658
That's it. That's all the causes of Undefined Behavior baked into Rust. Of
5759
course, unsafe functions and traits are free to declare arbitrary other

0 commit comments

Comments
 (0)