@@ -24,12 +24,17 @@ Types and Traits
24
24
:status: draft
25
25
26
26
In debug builds, Rust performs runtime checks for integer overflow and will panic if detected.
27
- However, in release builds (with optimizations enabled), unless the flag overflow-checks is
27
+ However, in release builds (with optimizations enabled), unless the flag ` overflow-checks `_ is
28
28
turned on, integer operations silently wrap around on overflow, creating potential for silent
29
29
failures and security vulnerabilities. Note that overflow-checks only brings the default panic
30
30
behavior from debug into release builds, avoiding potential silent wrap arounds. Nonetheless,
31
31
abrupt program termination is usually not suitable and, therefore, turning this flag on must
32
- not be used as a substitute of explicit handling.
32
+ not be used as a substitute of explicit handling. Furthermore, the behavior in release mode is
33
+ under consideration by the The Rust Language Design Team and in the future overflow checking
34
+ may be turned on by default in release builds (it is a `frequently requested change `_).
35
+
36
+ .. _overflow-checks : https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/codegen-options/index.md#overflow-checks
37
+ .. _frequently requested change : https://lang-team.rust-lang.org/frequently-requested-changes.html#numeric-overflow-checking-should-be-on-by-default-even-in-release-mode
33
38
34
39
Safety-critical software requires consistent and predictable behavior across all build
35
40
configurations. Explicit handling of potential overflow conditions improves code clarity,
0 commit comments