File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,18 @@ Types and Traits
14
14
:category: types
15
15
:recommendation: required
16
16
17
- Code must not rely on Rust's implicit integer wrapping behavior that occurs in release builds.
18
- Instead, explicitly handle potential overflows using the standard library's checked,
17
+ Code must not rely on Rust's implicit integer wrapping behavior that may occur in release
18
+ builds. Instead, explicitly handle potential overflows using the standard library's checked,
19
19
saturating, or wrapping operations.
20
20
21
21
.. rationale ::
22
22
:id: rat_kYiIiW8R2qD1
23
23
:status: draft
24
24
25
25
In debug builds, Rust performs runtime checks for integer overflow and will panic if detected.
26
- However, in release builds (with optimizations enabled), integer operations silently wrap
27
- around on overflow, creating potential for silent failures and security vulnerabilities.
26
+ However, in release builds (with optimizations enabled), unless the flag overflow-checks is
27
+ turned on, integer operations silently wrap around on overflow, creating potential for silent
28
+ failures and security vulnerabilities.
28
29
29
30
Safety-critical software requires consistent and predictable behavior across all build
30
31
configurations. Explicit handling of potential overflow conditions improves code clarity,
You can’t perform that action at this time.
0 commit comments