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 › RCE0008

RCE0008error

An operator on a type it isn't written for.

error[RCE0008]: {op} is supported on i16, i8, u8 and usize, not here: {src}
error[RCE0008]: {name} is supported on integers: {src}
error[RCE0008]: {name} by a variable is supported on i16 and u8, and >> on i8 and usize, not here: {src}
error[RCE0008]: ! is supported on bool, i16 and u8, not here: {src}

An operator used on a type the compiler has no code for it on.

Each operator is written for the types a card holds, and some for fewer: ! on bool, i16 and u8; << by a variable on i16 and u8; >> by a variable on i16, i8, u8 and usize. On a type outside those (a u16 that is a real value, an i8's <<), the compiler stops rather than guess.

Do the operation on an i16 or a u8, casting to it first.

let x: i8 = -3;
// refused: an i8's << by a variable
// let y = x << n;
let y = (x as i16) << n;

In a terminal: cargo cardiac help RCE0008.