Use min_captures for creating UpvarSusbts::tupled_upvar_tys
- final_upvar_tys now reads types from places instead of using `node_ty` Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
This commit is contained in:
parent
76c68aa182
commit
6e5cca79fc
2 changed files with 30 additions and 20 deletions
|
@ -624,6 +624,19 @@ impl<'tcx> TypeckResults<'tcx> {
|
|||
LocalTableInContextMut { hir_owner: self.hir_owner, data: &mut self.pat_adjustments }
|
||||
}
|
||||
|
||||
/// For a given closure, returns the iterator of `ty::CapturedPlace`s that are captured
|
||||
/// by the closure.
|
||||
pub fn closure_min_captures_flattened(
|
||||
&self,
|
||||
closure_def_id: DefId,
|
||||
) -> impl Iterator<Item = &ty::CapturedPlace<'tcx>> {
|
||||
self.closure_min_captures
|
||||
.get(&closure_def_id)
|
||||
.map(|closure_min_captures| closure_min_captures.values().flat_map(|v| v.iter()))
|
||||
.into_iter()
|
||||
.flatten()
|
||||
}
|
||||
|
||||
pub fn upvar_capture(&self, upvar_id: ty::UpvarId) -> ty::UpvarCapture<'tcx> {
|
||||
self.upvar_capture_map[&upvar_id]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue