1 Unsafe code was used outside of an unsafe function or block.
3 Erroneous code example:
6 unsafe fn f() { return; } // This is the unsafe code
9 f(); // error: call to unsafe function requires unsafe function or block
13 Using unsafe functionality is potentially dangerous and disallowed by safety
16 * Dereferencing raw pointers
17 * Calling functions via FFI
18 * Calling functions marked unsafe
20 These safety checks can be relaxed for a section of the code by wrapping the
21 unsafe instructions with an `unsafe` block. For instance:
24 unsafe fn f() { return; }
27 unsafe { f(); } // ok!
31 See also https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html