add more cases of UB

pull/158/head
Ralf Jung 5 years ago committed by Alexis Beingessner
parent a7aa0a8944
commit 01d11b8429

@ -22,16 +22,21 @@ language cares about is preventing the following things:
* Breaking the [pointer aliasing rules][]
* Producing invalid primitive values (either alone or as a field of a compound
type such as `enum`/`struct`/array/tuple):
* dangling/null/unaligned references
* dangling/null/unaligned references, references that do themselves point to
invalid values, or fat references (to a dynamically sized type) with
invalid metadata
* null `fn` pointers
* a `bool` that isn't 0 or 1
* an undefined `enum` discriminant
* a `char` outside the ranges [0x0, 0xD7FF] and [0xE000, 0x10FFFF]
* a non-utf8 `str`
* an uninitialized integer (`i*`/`u*`) or floating point value (`f*`)
* an invalid library type with custom invalid values, such as a `NonNull` or
`NonZero*` that is 0
* Unwinding into another language
* Causing a [data race][race]
* Executing code compiled with platform features that the current platform does
not support (see [`target_feature`])
"Producing" a value happens any time a value is assigned, passed to a
function/primitive operation or returned from a function/primitive operation.
@ -69,3 +74,4 @@ these problems are considered impractical to categorically prevent.
[pointer aliasing rules]: references.html
[uninitialized memory]: uninitialized.html
[race]: races.html
[`target_feature`]: ../reference/attributes/codegen.html#the-target_feature-attribute

Loading…
Cancel
Save