SQ in silver chrome letters, a lab's gear stacked against the S: a rack, two oscilloscopes, pizza boxes and a six-pack. Strange Query Lab

CARDIAC › rust-cardiac › Message codes › RCE0010

RCE0010error

Arithmetic in i32 that can pass a card.

error[RCE0010]: {method}, inlined in {f}, works in i32 so that it can't overflow, and on CARDIAC an i32 is a card (-999 to 999), past which it can: it is not supported

A library method that does its arithmetic in a wider type, so that it can't overflow, and on CARDIAC can.

Some methods of i16, such as midpoint, work in i32: (a as i32 + b as i32) / 2 never overflows. On CARDIAC every integer is a card, i32 too, so the sum in the middle can pass 999 where Rust's can't, and the answer would be wrong.

Write the arithmetic so that it stays on a card.

// refused
let m = a.midpoint(b);
// compiles, where a + b stays on a card
let m = (a + b) / 2;

In a terminal: cargo cardiac help RCE0010.