Struct rustc_borrowck::borrow_set::GatherBorrows [−][src]
struct GatherBorrows<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
body: &'a Body<'tcx>,
location_map: FxIndexMap<Location, BorrowData<'tcx>>,
activation_map: FxHashMap<Location, Vec<BorrowIndex>>,
local_map: FxHashMap<Local, FxHashSet<BorrowIndex>>,
pending_activations: FxHashMap<Local, BorrowIndex>,
locals_state_at_exit: LocalsStateAtExit,
}
Fields
tcx: TyCtxt<'tcx>
body: &'a Body<'tcx>
location_map: FxIndexMap<Location, BorrowData<'tcx>>
activation_map: FxHashMap<Location, Vec<BorrowIndex>>
local_map: FxHashMap<Local, FxHashSet<BorrowIndex>>
pending_activations: FxHashMap<Local, BorrowIndex>
When we encounter a 2-phase borrow statement, it will always be assigning into a temporary TEMP:
TEMP = &foo
We add TEMP into this map with b
, where b
is the index of
the borrow. When we find a later use of this activation, we
remove from the map (and add to the “tombstone” set below).
locals_state_at_exit: LocalsStateAtExit
Implementations
fn insert_as_pending_if_two_phase(
&mut self,
start_location: Location,
assigned_place: &Place<'tcx>,
kind: BorrowKind,
borrow_index: BorrowIndex
)
fn insert_as_pending_if_two_phase(
&mut self,
start_location: Location,
assigned_place: &Place<'tcx>,
kind: BorrowKind,
borrow_index: BorrowIndex
)
If this is a two-phase borrow, then we will record it as “pending” until we find the activating use.
Trait Implementations
fn visit_assign(
&mut self,
assigned_place: &Place<'tcx>,
rvalue: &Rvalue<'tcx>,
location: Location
)
fn visit_ascribe_user_ty(
&mut self,
place: &Place<'tcx>,
variance: &Variance,
user_ty: &UserTypeProjection,
location: Location
)
fn visit_projection(
&mut self,
place_ref: PlaceRef<'tcx>,
context: PlaceContext,
location: Location
)
fn visit_projection_elem(
&mut self,
local: Local,
proj_base: &[ProjectionElem<Local, &'tcx TyS<'tcx>>],
elem: ProjectionElem<Local, &'tcx TyS<'tcx>>,
context: PlaceContext,
location: Location
)
fn super_projection(
&mut self,
place_ref: PlaceRef<'tcx>,
context: PlaceContext,
location: Location
)
fn super_projection_elem(
&mut self,
_local: Local,
_proj_base: &[ProjectionElem<Local, &'tcx TyS<'tcx>>],
elem: ProjectionElem<Local, &'tcx TyS<'tcx>>,
_context: PlaceContext,
location: Location
)
fn visit_user_type_annotation(
&mut self,
index: UserTypeAnnotationIndex,
ty: &CanonicalUserTypeAnnotation<'tcx>
)
fn super_ascribe_user_ty(
&mut self,
place: &Place<'tcx>,
_variance: &Variance,
user_ty: &UserTypeProjection,
location: Location
)
fn super_user_type_annotation(
&mut self,
_index: UserTypeAnnotationIndex,
ty: &CanonicalUserTypeAnnotation<'tcx>
)
Auto Trait Implementations
impl<'a, 'tcx> !RefUnwindSafe for GatherBorrows<'a, 'tcx>
impl<'a, 'tcx> !Send for GatherBorrows<'a, 'tcx>
impl<'a, 'tcx> !Sync for GatherBorrows<'a, 'tcx>
impl<'a, 'tcx> Unpin for GatherBorrows<'a, 'tcx> where
'tcx: 'a,
impl<'a, 'tcx> !UnwindSafe for GatherBorrows<'a, 'tcx>
Blanket Implementations
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 200 bytes