|
|
@ -22,16 +22,21 @@ language cares about is preventing the following things:
|
|
|
|
* Breaking the [pointer aliasing rules][]
|
|
|
|
* Breaking the [pointer aliasing rules][]
|
|
|
|
* Producing invalid primitive values (either alone or as a field of a compound
|
|
|
|
* Producing invalid primitive values (either alone or as a field of a compound
|
|
|
|
type such as `enum`/`struct`/array/tuple):
|
|
|
|
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
|
|
|
|
* null `fn` pointers
|
|
|
|
* a `bool` that isn't 0 or 1
|
|
|
|
* a `bool` that isn't 0 or 1
|
|
|
|
* an undefined `enum` discriminant
|
|
|
|
* an undefined `enum` discriminant
|
|
|
|
* a `char` outside the ranges [0x0, 0xD7FF] and [0xE000, 0x10FFFF]
|
|
|
|
* a `char` outside the ranges [0x0, 0xD7FF] and [0xE000, 0x10FFFF]
|
|
|
|
* a non-utf8 `str`
|
|
|
|
* 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
|
|
|
|
* an invalid library type with custom invalid values, such as a `NonNull` or
|
|
|
|
`NonZero*` that is 0
|
|
|
|
`NonZero*` that is 0
|
|
|
|
* Unwinding into another language
|
|
|
|
* Unwinding into another language
|
|
|
|
* Causing a [data race][race]
|
|
|
|
* 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
|
|
|
|
"Producing" a value happens any time a value is assigned, passed to a
|
|
|
|
function/primitive operation or returned from a function/primitive operation.
|
|
|
|
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
|
|
|
|
[pointer aliasing rules]: references.html
|
|
|
|
[uninitialized memory]: uninitialized.html
|
|
|
|
[uninitialized memory]: uninitialized.html
|
|
|
|
[race]: races.html
|
|
|
|
[race]: races.html
|
|
|
|
|
|
|
|
[`target_feature`]: ../reference/attributes/codegen.html#the-target_feature-attribute
|
|
|
|