@@ -30,7 +30,7 @@ language cares about is preventing the following things:
30
30
* a ` char ` outside the ranges [ 0x0, 0xD7FF] and [ 0xE000, 0x10FFFF]
31
31
* a ` ! ` (all values are invalid for this type)
32
32
* an integer (` i* ` /` u* ` ), floating point value (` f* ` ), or raw pointer read from
33
- [ uninitialized memory] [ ]
33
+ [ uninitialized memory] [ ] , or uninitialized memory in a ` str ` .
34
34
* a reference/` Box ` that is dangling, unaligned, or points to an invalid value.
35
35
* a wide reference, ` Box ` , or raw pointer that has invalid metadata:
36
36
* ` dyn Trait ` metadata is invalid if it is not a pointer to a vtable for
@@ -48,11 +48,11 @@ A reference/pointer is "dangling" if it is null or not all of the bytes it
48
48
points to are part of the same allocation (so in particular they all have to be
49
49
part of * some* allocation). The span of bytes it points to is determined by the
50
50
pointer value and the size of the pointee type. As a consequence, if the span is
51
- empty, "dangling" is the same as "non-null". Note that slices point to their
52
- entire range, so it's important that the length metadata is never too large
53
- (in particular, allocations and therefore slices cannot be bigger than
54
- ` isize::MAX ` bytes). If for some reason this is too cumbersome, consider using
55
- raw pointers.
51
+ empty, "dangling" is the same as "non-null". Note that slices and strings point
52
+ to their entire range, so it's important that the length metadata is never too
53
+ large (in particular, allocations and therefore slices and strings cannot be
54
+ bigger than ` isize::MAX ` bytes). If for some reason this is too cumbersome,
55
+ consider using raw pointers.
56
56
57
57
That's it. That's all the causes of Undefined Behavior baked into Rust. Of
58
58
course, unsafe functions and traits are free to declare arbitrary other
0 commit comments