Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Unsafe Functions

A function or method can be marked unsafe if it has extra preconditions you must uphold to avoid undefined behaviour.

Unsafe functions may come from two places:

  • Rust functions declared unsafe.
  • Unsafe foreign functions in extern "C" blocks.
This slide and its sub-slides should take about 15 minutes.

We will look at the two kinds of unsafe functions next.