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

RCE0014error

A generic function from another crate.

error[RCE0014]: {within}call to {callee}{args}, a generic function in another crate: make it non-generic, or #[inline] so rustc inlines it

A call to a generic function of another crate, which rustc has no MIR of for these types.

rustc writes a crate's MIR once, in its generic form. The compiler needs each function for the types it is called with, and for a function of another crate it only has the generic one.

Make the function non-generic, or mark it #[inline], so rustc copies it into your program for your types.

// in the other crate
#[inline]
pub fn larger<T: PartialOrd>(a: T, b: T) -> T {
    if a > b { a } else { b }
}

In a terminal: cargo cardiac help RCE0014.