Skip to content

Commit 12b34a6

Browse files
RalfJungGankra
authored andcommitted
UB
1 parent 87159b8 commit 12b34a6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/what-unsafe-does.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@ to your program. You definitely *should not* invoke Undefined Behavior.
1616
Unlike C, Undefined Behavior is pretty limited in scope in Rust. All the core
1717
language cares about is preventing the following things:
1818

19-
* Dereferencing null, dangling, or unaligned pointers
19+
* Dereferencing null, dangling, or unaligned references or raw pointers
20+
* Performing out-of-bounds arithmetic for the computation of a struct/tuple
21+
field address
2022
* Reading [uninitialized memory][]
2123
* Breaking the [pointer aliasing rules][]
22-
* Producing invalid primitive values:
23-
* dangling/null references
24+
* Producing/obtaining invalid primitive values:
25+
* dangling/null/unaligned references
2426
* null `fn` pointers
2527
* a `bool` that isn't 0 or 1
2628
* an undefined `enum` discriminant
2729
* a `char` outside the ranges [0x0, 0xD7FF] and [0xE000, 0x10FFFF]
28-
* A non-utf8 `str`
30+
* a non-utf8 `str`
31+
* a compound type (`enum`/`struct`/array/tuple) with an invalid field
2932
* Unwinding into another language
3033
* Causing a [data race][race]
3134

0 commit comments

Comments
 (0)