Convenient examples of undefined behavior in rust.
Unless otherwise stated, every test should exhibit UB when run with Miri.
cargo miri test ptr::test_no_provenance -- --exact
For the most part, tests that do not exhibit UB are named test_ok_*
.
Many of the examples exhibit undefined behavior under the default Stacked Borrows (SB) aliasing model, but not under the Tree Borrows (TB) model. Any test can be run under TB with -Zmiri-tree-borrows
:
MIRIFLAGS="-Zmiri-tree-borrows" cargo miri test borrows::test_reserved