From 933fc180bd7a3a096e9412e8535cd254a92705be Mon Sep 17 00:00:00 2001 From: Eric Mark Martin Date: Wed, 26 Jul 2023 00:15:29 -0400 Subject: [PATCH] add stable NullaryOp --- compiler/rustc_smir/src/rustc_smir/mod.rs | 4 +++- compiler/rustc_smir/src/stable_mir/mir/body.rs | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_smir/src/rustc_smir/mod.rs b/compiler/rustc_smir/src/rustc_smir/mod.rs index 044e2f8f325..9bf3d031217 100644 --- a/compiler/rustc_smir/src/rustc_smir/mod.rs +++ b/compiler/rustc_smir/src/rustc_smir/mod.rs @@ -156,7 +156,9 @@ fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T { ops.0.stable(tables), ops.1.stable(tables), ), - NullaryOp(_, _) => todo!(), + NullaryOp(null_op, ty) => { + stable_mir::mir::Rvalue::NullaryOp(null_op.stable(tables), tables.intern_ty(*ty)) + } UnaryOp(un_op, op) => { stable_mir::mir::Rvalue::UnaryOp(un_op.stable(tables), op.stable(tables)) } diff --git a/compiler/rustc_smir/src/stable_mir/mir/body.rs b/compiler/rustc_smir/src/stable_mir/mir/body.rs index 831eb6589e4..1b1871bcd2a 100644 --- a/compiler/rustc_smir/src/stable_mir/mir/body.rs +++ b/compiler/rustc_smir/src/stable_mir/mir/body.rs @@ -218,6 +218,9 @@ pub enum Rvalue { /// nature of this operation? ThreadLocalRef(stable_mir::CrateItem), + /// Computes a value as described by the operation. + NullaryOp(NullOp, Ty), + /// Exactly like `BinaryOp`, but less operands. /// /// Also does two's-complement arithmetic. Negation requires a signed integer or a float;