Rollup merge of #141683 - compiler-errors:unsafe-binder-capture, r=oli-obk

Handle ed2021 precise capturing of unsafe binder

Missing pieces from last pr.

r? oli-obk

Fixes https://github.com/rust-lang/rust/issues/141655
This commit is contained in:
Jacob Pratt
2025-05-29 04:49:45 +02:00
committed by GitHub
3 changed files with 9 additions and 2 deletions

View File

@@ -101,12 +101,12 @@ fn convert_to_hir_projections_and_truncate_for_capture(
variant = Some(*idx);
continue;
}
ProjectionElem::UnwrapUnsafeBinder(_) => HirProjectionKind::UnwrapUnsafeBinder,
// These do not affect anything, they just make sure we know the right type.
ProjectionElem::OpaqueCast(_) | ProjectionElem::Subtype(..) => continue,
ProjectionElem::Index(..)
| ProjectionElem::ConstantIndex { .. }
| ProjectionElem::Subslice { .. }
| ProjectionElem::UnwrapUnsafeBinder(_) => {
| ProjectionElem::Subslice { .. } => {
// We don't capture array-access projections.
// We can stop here as arrays are captured completely.
break;