Skip to content

Commit 9056718

Browse files
authored
Fix capture copy analysis for box (#148)
1 parent c7528cd commit 9056718

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/par/process.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,14 @@ impl Expression<()> {
538538
)
539539
}
540540
Self::Box(span, _, expression, typ) => {
541-
let (expression, caps) = expression.fix_captures(loop_points, later_captures);
541+
let (expression, mut caps) = expression.fix_captures(loop_points, later_captures);
542+
for (name, (_span, usage)) in caps.names.iter_mut() {
543+
if later_captures.contains(name) {
544+
*usage = VariableUsage::Copy;
545+
} else {
546+
*usage = VariableUsage::Move;
547+
}
548+
}
542549
(
543550
Arc::new(Self::Box(
544551
span.clone(),

0 commit comments

Comments
 (0)