You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you invoke these functions, it is common to have a local variable `block` that is effectively a "cursor". It represents the point at which we are adding new MIR. When you invoke `generate_more_mir`, you want to update this cursor. You can do this manually, but it's tedious:
68
+
69
+
```rust
70
+
letmutblock;
71
+
letv=matchself.generate_more_mir(..) {
72
+
BlockAnd { block:new_block, value:v } => {
73
+
block=new_block;
74
+
v
75
+
}
76
+
};
77
+
```
78
+
79
+
For this reason, we offer a macro that lets you write
80
+
`let v = unpack!(block = self.generate_more_mir(...))`.
81
+
It simply extracts the new block and overwrites the
82
+
variable `block` that you named in the `unpack!`.
83
+
MIR functions that generate statements always take as argument a
84
+
basic block onto which the statements should be appended.
0 commit comments