Function rustc_mir_build::build::expr::as_place::find_capture_matching_projections [−][src]
fn find_capture_matching_projections<'a, 'tcx>(
typeck_results: &'a TypeckResults<'tcx>,
var_hir_id: HirId,
closure_def_id: DefId,
projections: &[PlaceElem<'tcx>]
) -> Option<(usize, &'a CapturedPlace<'tcx>)>
Expand description
Given a closure, returns the index of a capture within the desugared closure struct and the
ty::CapturedPlace
which is the ancestor of the Place represented using the var_hir_id
and projection
.
Note there will be at most one ancestor for any given Place.
Returns None, when the ancestor is not found.