Skip to main content

Module closure

Module closure 

Source

Re-exportsยง

use std::cmp; ๐Ÿ”’
use std::fmt::Write; ๐Ÿ”’
use rustc_data_structures::fx::FxIndexMap; ๐Ÿ”’
use rustc_hir as hir; ๐Ÿ”’
use rustc_hir::HirId; ๐Ÿ”’
use rustc_hir::def_id::LocalDefId; ๐Ÿ”’
use rustc_macros::StableHash; ๐Ÿ”’
use rustc_macros::TyDecodable; ๐Ÿ”’
use rustc_macros::TyEncodable; ๐Ÿ”’
use rustc_macros::TypeFoldable; ๐Ÿ”’
use rustc_macros::TypeVisitable; ๐Ÿ”’
use rustc_span::def_id::LocalDefIdMap; ๐Ÿ”’
use rustc_span::Ident; ๐Ÿ”’
use rustc_span::Span; ๐Ÿ”’
use rustc_span::Symbol; ๐Ÿ”’
use rustc_span::bug; ๐Ÿ”’
use super::TyCtxt; ๐Ÿ”’
use crate::hir::place::Place as HirPlace; ๐Ÿ”’
use crate::hir::place::PlaceBase as HirPlaceBase; ๐Ÿ”’
use crate::hir::place::ProjectionKind as HirProjectionKind; ๐Ÿ”’
use crate::query::Providers; ๐Ÿ”’
use crate::mir; ๐Ÿ”’
use crate::ty; ๐Ÿ”’

Structsยง

CaptureInfo
Part of MinCaptureInformationMap; describes the capture kind (&, &mut, move) for a particular capture as well as identifying the part of the source code that triggered this capture to occur.
CapturedPlace
A composite describing a Place that is captured by a closure.
ClosureTypeInfo
UpvarId
Upvars do not get their own NodeId. Instead, we use the pair of the original var ID (that is, the root variable that is referenced by the upvar) and the ID of the closure expression.
UpvarPath

Enumsยง

BorrowKind
UpvarCapture
Information describing the capture of an upvar. This is computed during typeck, specifically by regionck.

Constantsยง

CAPTURE_STRUCT_LOCAL
Captures are represented using fields inside a structure. This represents accessing self in the closure structure

Functionsยง

analyze_coroutine_closure_captures
child_prefix_matches_parent_projections ๐Ÿ”’
closure_typeinfo ๐Ÿ”’
is_ancestor_or_same_capture
Return true if the proj_possible_ancestor represents an ancestor path to proj_capture or proj_possible_ancestor is same as proj_capture, assuming they both start off of the same root variable.
place_to_string_for_capture
provide

Type Aliasesยง

MinCaptureInformationMap
Given the closure DefId this map provides a map of root variables to minimum set of CapturedPlaces that need to be tracked to support all captures of that closure.
MinCaptureList
Part of MinCaptureInformationMap; List of CapturePlaces.
RootVariableMinCaptureList
Part of MinCaptureInformationMap; Maps a root variable to the list of CapturedPlace. Used to track the minimum set of Places that need to be captured to support all Places captured by the closure starting at a given root variable.