Rust code, including within
unsafe blocks and
unsafe functions is incorrect if it exhibits any of the behaviors in the following list. It is the programmer's responsibility when writing
unsafe code that it is not possible to let
safe code exhibit these behaviors.
Warning: The following list is not exhaustive. There is no formal model of Rust's semantics for what is and is not allowed in unsafe code, so there may be more behavior considered unsafe. The following list is just what we know for sure is undefined behavior. Please read the Rustonomicon before writing unsafe code.
&Tfollow LLVM’s scoped noalias model, except if the
letbinding), unless that data is contained within an
1) in a
enumnot included in the type definition.
charwhich is a surrogate or above
Note: Undefined behavior affects the entire program. For example, calling a function in C that exhibits undefined behavior of C means your entire program contains undefined behaviour that can also affect the Rust code. And vice versa, undefined behavior in Rust can cause adverse affects on code executed by any FFI calls to other languages.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.