2229: Handle update to capture kind properly

This commit is contained in:
Aman Arora 2021-08-29 15:37:03 -04:00
parent ef52471066
commit fbd775ff29
2 changed files with 24 additions and 0 deletions

View file

@ -400,6 +400,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};
capture_info.capture_kind = capture_kind;
let capture_info = if let Some(existing) = processed.get(&place) {
determine_capture_info(*existing, capture_info)
} else {
capture_info
};
processed.insert(place, capture_info);
}

View file

@ -0,0 +1,19 @@
// edition:2021
// run-pass
fn solve<F>(validate: F) -> Option<u64>
where
F: Fn(&mut [i8; 1]),
{
let mut position: [i8; 1] = [1];
Some(0).map(|_| {
validate(&mut position);
let [_x] = position;
0
})
}
fn main() {
solve(|_| ());
}