Loading tutorials
unsafe, it cannot cause undefined behavior. The unsafe keyword marks the places where you take over part of that promise. This chapter covers what unsafe unlocks, what it leaves switched on, and why the rest of this tutorial needs a t6 min readcargo test, and have used raw pointers and the unsafe keyword at a basic level. Here you learn what undefined behavior (UB) is, which operations cause it, and why a green test suite says little about it. Miri comes la5 min readcargo run and cargo test, and with raw pointers and the unsafe keyword at a basic level. The previous chapters explained why undefined behavior (UB) is dangerous and why ordinary tests of6 min readcargo run, cargo test), raw pointers and the unsafe keyword, and how to install toolchains and c7 min readcargo miri run and cargo miri test from the previous chapter, and that you know what undefined behavior (UB) is. Here you learn to read what Miri prints when it stops. A report names the kind of failure, the source location, and often the earlier event that cause5 min readunsafe Rust with raw pointers, you know how Vec and Box own heap memory, and you can run cargo +nightly miri run as shown in the previous chapters. Here you will see how Miri catches the two most common memory errors, and how to read and fix each repo5 min readcargo miri test and read a basic Miri report, as covered earlier in the tutorial. You should also know what unsafe, raw pointers, and std::mem::transmute are at a basic level.6 min readcargo miri test and read a basic Miri report. It also assumes you know what an aliasing violation is and that you can set an environment variable in your shell. The goal is to change how Miri behaves without editing your code.5 min read*const T, *mut T, add, dereferencing). It also assumes you can run cargo +nightly miri run as shown earlier in the tutorial. You do not need to know Stacked Borrows or Tree Borrows yet. The next chapter covers them.5 min readcargo miri test with MIRIFLAGS. It covers the aliasing errors Miri reports most often, the two models that define them, and how to read and fix each one.6 min readthread::spawn, join), the basics of Arc, Mutex and atomics, and how to run cargo miri test and read a Miri report from earlier chapters. Here you will learn what Miri counts as a data race, how it finds one, and how to fix and reproduce races.7 min readcargo miri test and read a Miri report. It covers what to do next. It maps each kind of error to a fix, shows corrected versions of the earlier failing programs, and ends with habits that stop the same bug coming back.5 min readcargo miri test locally, read a Miri error report, and set MIRIFLAGS. It also assumes you know what #[cfg(miri)] does in a test. Here you will move those local checks into a continuous integration (CI) pipeline, so that undefined behavior (UB) in unsafe code fa7 min readcargo +nightly miri test, read a Miri error report, and know the basic aliasing and provenance rules from earlier chapters. It covers how to interpret a run with no errors. A clean run is useful evidence. It is not a proof that your code is sound.6 min read