Function rustc_typeck::check::op::is_builtin_binop[][src]

fn is_builtin_binop(lhs: Ty, rhs: Ty, op: BinOp) -> bool
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Returns true if this is a built-in arithmetic operation (e.g. u32

  1. Builtin operations can trivially be evaluated in constants.
  2. For comparison operators applied to SIMD types the result is not of type bool. For example, i16x4==i16x4 yields a type like i16x4. This means that the overloaded trait PartialEq is not applicable.

Reason #2 is the killer. I tried for a while to always use overloaded logic and just check the types in constants/codegen after the fact, and it worked fine, except for SIMD types. -nmatsakis