pub enum Rvalue {
Use(Operand),
Borrow(BorrowKind, Place),
BinaryOp(BinOp, Operand, Operand),
UnaryOp(UnOp, Operand),
Aggregate(Vec<Operand>),
Clone(Operand),
EnumTest {
operand: Operand,
variant: VariantTag,
},
EnumPayload {
operand: Operand,
variant: VariantTag,
},
TypePatternTest {
operand: Operand,
type_annotation: TypeAnnotation,
},
EnumDiscriminantTest {
operand: Operand,
enum_name: Option<String>,
variant_name: String,
},
}Expand description
Right-hand side of an assignment.
Variants§
Use(Operand)
Use an operand directly.
Borrow(BorrowKind, Place)
Create a borrow: &place or &mut place
BinaryOp(BinOp, Operand, Operand)
Binary operation.
UnaryOp(UnOp, Operand)
Unary operation.
Aggregate(Vec<Operand>)
Function call result (arguments passed via terminator). This is a placeholder — actual calls use Call terminators.
Clone(Operand)
Clone of a value (explicit or auto-inferred).
EnumTest
Test whether a Result/Option scrutinee matches a specific variant
(per ADR-006 §2.7.17 / Q18 — kinded Arc<ResultData> /
Arc<OptionData> carrier). Result: native Bool (I8).
Emitted by lower_match_pattern_condition_operand when the scrutinee
is a Pattern::Constructor with a recognised VariantTag::Ok /
Err / Some_ / None_. JIT consumer dispatches to the
jit_arc_result_is_ok / _is_err / jit_arc_option_is_some /
_is_none FFI which reads is_ok / is_some from the
*const ResultData / *const OptionData directly per §2.7.17
— no NaN-box tag decode, no is_heap_kind probe (§2.7.7 #4 / #7
forbidden).
Producer-side classification per W12-jit-result-option-trinity
audit (docs/cluster-audits/w12-jit-match-enum-inline-audit.md §6.1).
EnumPayload
Extract the inner payload bits from a Result/Option scrutinee.
Caller must have already proven the variant via EnumTest
(control flow guarantees the matching arm is entered only when
the variant matches; the variant tag here is the producer-side
classification for kind sourcing, NOT a runtime check).
Result: raw u64 payload bits — the payload’s kind flows out of
band via 6A’s Call-return-kind track + the EnumStore producer’s
kind stamp.
JIT consumer dispatches to jit_arc_result_payload /
jit_arc_option_payload which read the inner KindedSlot.raw()
from the *const ResultData / *const OptionData and bump the
inner refcount per the receiver-recovery soundness rule —
the returned bits are an owned slot.
VariantTag::None_ is rejected at consumer time (no payload to
extract — None’s payload field is a zero-bits Bool placeholder
per ADR-006 §2.7.17 OptionData::none()).
Producer-side classification per W12-jit-result-option-trinity audit §6.2.
TypePatternTest
Test whether the scrutinee’s runtime kind matches a Pattern::Typed
type annotation (e.g. match x { n: int => ..., s: string => ... }).
Result: native Bool (I8).
W15.2-LANG-5 (Phase 4b, 2026-05-18). Pre-fix the MIR lowering of
Pattern::Typed returned None for the condition operand — same
shape as Pattern::Wildcard/Pattern::Identifier — so every typed
match arm was reached via TerminatorKind::Goto with NO type
discrimination. The first arm always won and the union-scrutinee
silently took the wrong branch under JIT.
Producer-side classification per ADR-006 §2.7.5 stamp-at-compile-time:
the type annotation is carried verbatim from ast::Pattern::Typed
so consumers do not re-derive it from the operand bits.
Consumer status:
- JIT MIR preflight (
shape-jit::mir_compiler::preflight) REJECTS on this Rvalue → W12 fall-through routes the program to the bytecode interpreter, which compiles the same scrutinee via theOpCode::TypeCheckpath incompiler/patterns/checking.rs. Native JIT codegen lands as a follow-up (jit_type_checkFFI + per-kind dispatch on the §2.7.7 stack parallel-kind track). - VM never consumes MIR;
compile_match_exprincompiler/expressions/advanced.rscallscompile_pattern_checkdirectly on the AST and emitsOpCode::TypeCheckitself.
The annotation IS the producer-side classification — neither a Bool-default fabrication nor any of the deleted dispatch families enumerated under CLAUDE.md Forbidden Patterns.
EnumDiscriminantTest
Test whether the scrutinee’s enum discriminant matches a specific
user-defined Pattern::Constructor variant (e.g. match c { Color::Red => ..., Color::Green => ... }). Result: native Bool
(I8).
W15.2-LANG-1 (Phase 4b, 2026-05-18). Pre-fix the MIR lowering of
Pattern::Constructor for non-trinity (non-Ok/Err/Some/None)
variants returned Some(Operand::Copy(Place::Local(scrutinee_slot)))
— the raw Arc<TypedObjectStorage> pointer bits — as the
SwitchBool condition. The JIT consumer’s generic I64-truthy
check at terminators.rs::SwitchBool then evaluated the non-zero
pointer as true for the first arm OR fell to false-branch when
the multi-arm dispatch chain looped past the first arm, producing
silent-empty-output for the user’s match Color::Red { Color::Red => print("red"), ... } case (book snippet enums.mdx:113).
Producer-side classification per ADR-006 §2.7.5 stamp-at-compile-
time: the enum name + variant name are carried verbatim from
ast::Pattern::Constructor so the consumer dispatches on a known
(enum_name, variant_name) pair, NEVER on raw scrutinee bits.
Consumer status:
- JIT MIR preflight (
shape-jit::mir_compiler::preflight) REJECTS on this Rvalue → W12 fall-through routes the program to the bytecode interpreter, which compiles the same scrutinee via thecompile_typed_enum_pattern_checkpath incompiler/patterns/checking.rs(emitsGetFieldTyped(__variant, I64)+PushConst(expected_variant_id)+EqInt). - VM never consumes MIR;
compile_match_exprincompiler/expressions/advanced.rscallscompile_pattern_checkdirectly on the AST and emits the typed-object discriminant check itself.
The (enum_name, variant_name) pair IS the producer-side
classification — neither a Bool-default fabrication nor any of
the deleted dispatch families enumerated under CLAUDE.md
Forbidden Patterns. Mirrors the LANG-5 TypePatternTest
precedent (W15.2-LANG-5 close 2026-05-18) for Pattern::Typed.
Trait Implementations§
impl StructuralPartialEq for Rvalue
Auto Trait Implementations§
impl Freeze for Rvalue
impl RefUnwindSafe for Rvalue
impl Send for Rvalue
impl Sync for Rvalue
impl Unpin for Rvalue
impl UnsafeUnpin for Rvalue
impl UnwindSafe for Rvalue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more