Skip to main content

usual_arithmetic

Function usual_arithmetic 

Source
pub fn usual_arithmetic(
    types: &mut Types,
    left: TypeId,
    right: TypeId,
    target: &TargetInfo,
) -> Option<TypeId>
Expand description

The usual arithmetic conversions, 6.3.1.8: the one type both operands are converted to.

None when either operand is not an arithmetic type, which is not a failure of this function but the shape of a diagnostic its caller is about to write.

The floating rules come first and the integer rules only run when neither side is floating, which is why unsigned long long + float is float and loses precision rather than being the other way round.