Skip to content

Commit fbd775f

Browse files
committed
2229: Handle update to capture kind properly
1 parent ef52471 commit fbd775f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

compiler/rustc_typeck/src/check/upvar.rs

+5
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
400400
};
401401

402402
capture_info.capture_kind = capture_kind;
403+
let capture_info = if let Some(existing) = processed.get(&place) {
404+
determine_capture_info(*existing, capture_info)
405+
} else {
406+
capture_info
407+
};
403408
processed.insert(place, capture_info);
404409
}
405410

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// edition:2021
2+
// run-pass
3+
4+
5+
fn solve<F>(validate: F) -> Option<u64>
6+
where
7+
F: Fn(&mut [i8; 1]),
8+
{
9+
let mut position: [i8; 1] = [1];
10+
Some(0).map(|_| {
11+
validate(&mut position);
12+
let [_x] = position;
13+
0
14+
})
15+
}
16+
17+
fn main() {
18+
solve(|_| ());
19+
}

0 commit comments

Comments
 (0)