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

RCE0017error

An enum with data used in a way not supported yet.

error[RCE0017]: {f}: {line}: a constant of an enum with data is not supported yet
error[RCE0017]: {f}: {line}: an enum with data used this way is not supported yet
error[RCE0017]: {f}: {line}: an enum with data returned into this place is not supported yet
error[RCE0017]: {f}: {line}: a variant of another enum
error[RCE0017]: {p}: a projection of an enum with data that isn't a variant's field
error[RCE0017]: {p}: no such variant or field

An enum with data (Option<i16>, Result, an enum of your own with fields) used in a way the compiler doesn't lay out yet.

An enum with data is a tag cell, the variant's number, and cells for its fields, which the variants share. Building one, matching on it, passing and returning it compile. Some uses don't yet: an enum constant rustc writes as raw bytes, an enum with data copied into some places, nested in ways the layout doesn't follow.

Build the value where it is used, and take it apart with match or if let. A struct of a tag and the fields does the same job.

let r = if ok { Some(v) } else { None };
match r {
    Some(v) => out(v),
    None => out(-1),
}

In a terminal: cargo cardiac help RCE0017.