core::intrinsics

Function unchecked_sub

const: 1.79.0 · Source
pub const unsafe extern "rust-intrinsic" fn unchecked_sub<T: Copy>(
    x: T,
    y: T,
) -> T
🔬This is a nightly-only experimental API. (core_intrinsics)
Expand description

Returns the result of an unchecked subtraction, resulting in undefined behavior when x - y > T::MAX or x - y < T::MIN.

The stable counterpart of this intrinsic is unchecked_sub on the various integer types, such as u16::unchecked_sub and i64::unchecked_sub.