pub trait DebugStrictAdd {
// Required method
fn debug_strict_add(self, other: Self) -> Self;
}
Expand description
Addition, but only overflow checked when cfg(debug_assertions)
is set
instead of respecting -Coverflow-checks
.
This exists for performance reasons, as we ship rustc with overflow checks. While overflow checks are perf neutral in almost all of the compiler, there are a few particularly hot areas where we don’t want overflow checks in our dist builds. Overflow is still a bug there, so we want overflow check for builds with debug assertions.
That’s a long way to say that this should be used in areas where overflow is a bug but overflow checking is too slow.
Required Methods§
sourcefn debug_strict_add(self, other: Self) -> Self
fn debug_strict_add(self, other: Self) -> Self
See DebugStrictAdd
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.