Function rustc_mir_build::build::expr::as_place::find_capture_matching_projections
source · fn find_capture_matching_projections<'a, 'tcx>(
upvars: &'a SortedIndexMultiMap<usize, HirId, Capture<'tcx>>,
var_hir_id: LocalVarId,
projections: &[PlaceElem<'tcx>]
) -> Option<(usize, &'a Capture<'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.