Skip to content

Commit 02b64d1

Browse files
RalfJungGankra
authored andcommitted
clarify dangling
1 parent 0521596 commit 02b64d1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/what-unsafe-does.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ language cares about is preventing the following things:
4747
function/primitive operation or returned from a function/primitive operation.
4848

4949
A reference/pointer is "dangling" if it is null or not all of the bytes it
50-
points to are part of the same allocation. The span of bytes it points to is
51-
determined by the pointer value and the size of the pointee type. If the span
52-
is empty, "dangling" is the same as "non-null".
50+
points to are part of the same allocation (so in particular they all have to be
51+
part of *some* allocation). The span of bytes it points to is determined by the
52+
pointer value and the size of the pointee type. As a consequence, if the span is
53+
empty, "dangling" is the same as "non-null".
5354

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

0 commit comments

Comments
 (0)