Back to Comprehensive Rust

Safety Preconditions

src/unsafe-deep-dive/safety-preconditions.md

latest488 B
Original Source
<!-- Copyright 2026 Google LLC SPDX-License-Identifier: CC-BY-4.0 -->

Safety Preconditions

Safety preconditions are conditions on an action that must be satisfied before that action will be safe.

<details>

“Safety preconditions are conditions on code that must be satisfied to maintain Rust's safety guarantees

“You're likely to see a strong affinity between safety preconditions and the rules of Safe Rust.”

Q: Can you list any?

(Fuller list in the next slide)

</details>