Skip to main content

is_builtin_binop

Function is_builtin_binop 

Source
fn is_builtin_binop<'tcx>(
    lhs: Ty<'tcx>,
    rhs: Ty<'tcx>,
    category: BinOpCategory,
) -> bool
Expand description

Returns true if this is a built-in arithmetic operation (e.g., u32 + u32) and false if these types would have to be overloaded to be legal. The reason that we distinguish builtin operations from overloaded ones (vs trying to drive everything uniformly through the trait system and intrinsics or something like that) is that builtin operations can trivially be evaluated in constants on stable, but the traits and their impls for these primitive types.

FIXME(const_trait_impls): once the traits and their impls are const stable remove this function and the builtin-specific checks.