Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir.rs')
-rw-r--r--crates/hir-ty/src/mir.rs23
1 files changed, 18 insertions, 5 deletions
diff --git a/crates/hir-ty/src/mir.rs b/crates/hir-ty/src/mir.rs
index 6dc20203e0..bf80ed7967 100644
--- a/crates/hir-ty/src/mir.rs
+++ b/crates/hir-ty/src/mir.rs
@@ -77,7 +77,14 @@ pub struct Local {
/// currently implements it, but it seems like this may be something to check against in the
/// validator.
#[derive(Debug, PartialEq, Eq, Clone)]
-pub enum Operand {
+pub struct Operand {
+ kind: OperandKind,
+ // FIXME : This should actually just be of type `MirSpan`.
+ span: Option<MirSpan>,
+}
+
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum OperandKind {
/// Creates a value by loading the given place.
///
/// Before drop elaboration, the type of the place must be `Copy`. After drop elaboration there
@@ -101,7 +108,13 @@ pub enum Operand {
impl Operand {
fn from_concrete_const(data: Box<[u8]>, memory_map: MemoryMap, ty: Ty) -> Self {
- Operand::Constant(intern_const_scalar(ConstScalar::Bytes(data, memory_map), ty))
+ Operand {
+ kind: OperandKind::Constant(intern_const_scalar(
+ ConstScalar::Bytes(data, memory_map),
+ ty,
+ )),
+ span: None,
+ }
}
fn from_bytes(data: Box<[u8]>, ty: Ty) -> Self {
@@ -1076,11 +1089,11 @@ impl MirBody {
f: &mut impl FnMut(&mut Place, &mut ProjectionStore),
store: &mut ProjectionStore,
) {
- match op {
- Operand::Copy(p) | Operand::Move(p) => {
+ match &mut op.kind {
+ OperandKind::Copy(p) | OperandKind::Move(p) => {
f(p, store);
}
- Operand::Constant(_) | Operand::Static(_) => (),
+ OperandKind::Constant(_) | OperandKind::Static(_) => (),
}
}
for (_, block) in self.basic_blocks.iter_mut() {