1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-07-17 03:22:22 +02:00

Speaker notes for “Runtime Guarantees”

This commit is contained in:
Martin Geisler
2023-01-07 16:46:57 +01:00
committed by Martin Geisler
parent ba3c6b0de9
commit b1e11304a7

View File

@ -4,3 +4,19 @@ No undefined behavior at runtime:
* Array access is bounds checked.
* Integer overflow is defined.
<details>
Key points:
* Integer overflow is defined via a compile-time flag. The options are
either a panic (a controlled crash of the program) or wrap-around
semantics. By default, you get panics in debug mode (`cargo build`)
and wrap-around in release mode (`cargo build --release`).
* Bounds checking cannot be disabled with a compiler flag. It can also
not be disabled directly with the `unsafe` keyword. However,
`unsafe` allows you to call functions such as `slice::get_unchecked`
which does not do bounds checking.
</details>