19. UnsafetyΒΆ
Legality Rules
19:1 Unsafety is the presence of unsafe operations and unsafe trait implementations in program text.
19:2 An unsafe operation is an operation that may result in undefined behavior that is not diagnosed as a static error. Unsafe operations are referred to as unsafe Rust.
19:3 The unsafe operations are:
19:4 Dereferencing a value of a raw pointer type.
19:5 Reading or writing an external static.
19:6 Reading or writing a mutable static.
19:7 Accessing a field of a union, other than to assign to it.
19:8 Calling an unsafe function.
19:9 Calling macro
core::arch::asm
.
19:10 An unsafe context is either an unsafe block or an unsafe function.
19:11 An unsafe operation shall be used only within an unsafe context.