Fix subslice capture in closure
This commit is contained in:
parent
dd19135b04
commit
f995003ec5
3 changed files with 41 additions and 3 deletions
|
|
@ -1893,14 +1893,13 @@ fn restrict_capture_precision(
|
|||
|
||||
for (i, proj) in place.projections.iter().enumerate() {
|
||||
match proj.kind {
|
||||
ProjectionKind::Index => {
|
||||
// Arrays are completely captured, so we drop Index projections
|
||||
ProjectionKind::Index | ProjectionKind::Subslice => {
|
||||
// Arrays are completely captured, so we drop Index and Subslice projections
|
||||
truncate_place_to_len_and_update_capture_kind(&mut place, &mut curr_mode, i);
|
||||
return (place, curr_mode);
|
||||
}
|
||||
ProjectionKind::Deref => {}
|
||||
ProjectionKind::Field(..) => {} // ignore
|
||||
ProjectionKind::Subslice => {} // We never capture this
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue