core::intrinsics

Function three_way_compare

Source
pub const extern "rust-intrinsic" fn three_way_compare<T: Copy>(
    lhs: T,
    rhs: T,
) -> Ordering
🔬This is a nightly-only experimental API. (core_intrinsics)
Expand description

Does a three-way comparison between the two integer arguments.

This is included as an intrinsic as it’s useful to let it be one thing in MIR, rather than the multiple checks and switches that make its IR large and difficult to optimize.

The stabilized version of this intrinsic is Ord::cmp.