Struct rustc::infer::region_inference::RegionVarBindings
[−]
[src]
pub struct RegionVarBindings<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /* fields omitted */ }
rustc_private
)Methods
impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx>
[src]
fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> RegionVarBindings<'a, 'gcx, 'tcx>
rustc_private
)fn start_snapshot(&self) -> RegionSnapshot
rustc_private
)fn commit(&self, snapshot: RegionSnapshot)
rustc_private
)fn rollback_to(&self, snapshot: RegionSnapshot)
rustc_private
)fn rollback_undo_entry(&self, undo_entry: UndoLogEntry<'tcx>)
rustc_private
)fn num_vars(&self) -> u32
rustc_private
)fn new_region_var(&self, origin: RegionVariableOrigin) -> RegionVid
rustc_private
)fn var_origin(&self, vid: RegionVid) -> RegionVariableOrigin
rustc_private
)fn push_skolemized(&self,
br: BoundRegion,
snapshot: &RegionSnapshot)
-> &'tcx Region
br: BoundRegion,
snapshot: &RegionSnapshot)
-> &'tcx Region
rustc_private
)Creates a new skolemized region. Skolemized regions are fresh regions used when performing higher-ranked computations. They must be used in a very particular way and are never supposed to "escape" out into error messages or the code at large.
The idea is to always create a snapshot. Skolemized regions
can be created in the context of this snapshot, but before the
snapshot is committed or rolled back, they must be popped
(using pop_skolemized_regions
), so that their numbers can be
recycled. Normally you don't have to think about this: you use
the APIs in higher_ranked/mod.rs
, such as
skolemize_late_bound_regions
and plug_leaks
, which will
guide you on this path (ensure that the SkolemizationMap
is
consumed and you are good). There are also somewhat extensive
comments in higher_ranked/README.md
.
The snapshot
argument to this function is not really used;
it's just there to make it explicit which snapshot bounds the
skolemized region that results. It should always be the top-most snapshot.
fn pop_skolemized(&self,
skols: &FxHashSet<&'tcx Region>,
snapshot: &RegionSnapshot)
skols: &FxHashSet<&'tcx Region>,
snapshot: &RegionSnapshot)
rustc_private
)Removes all the edges to/from the skolemized regions that are
in skols
. This is used after a higher-ranked operation
completes to remove all trace of the skolemized regions
created in that time.
fn new_bound(&self, debruijn: DebruijnIndex) -> &'tcx Region
rustc_private
)fn add_given(&self, sub: FreeRegion, sup: RegionVid)
rustc_private
)fn make_eqregion(&self,
origin: SubregionOrigin<'tcx>,
sub: &'tcx Region,
sup: &'tcx Region)
origin: SubregionOrigin<'tcx>,
sub: &'tcx Region,
sup: &'tcx Region)
rustc_private
)fn make_subregion(&self,
origin: SubregionOrigin<'tcx>,
sub: &'tcx Region,
sup: &'tcx Region)
origin: SubregionOrigin<'tcx>,
sub: &'tcx Region,
sup: &'tcx Region)
rustc_private
)fn verify_generic_bound(&self,
origin: SubregionOrigin<'tcx>,
kind: GenericKind<'tcx>,
sub: &'tcx Region,
bound: VerifyBound<'tcx>)
origin: SubregionOrigin<'tcx>,
kind: GenericKind<'tcx>,
sub: &'tcx Region,
bound: VerifyBound<'tcx>)
rustc_private
)See Verify::VerifyGenericBound
fn lub_regions(&self,
origin: SubregionOrigin<'tcx>,
a: &'tcx Region,
b: &'tcx Region)
-> &'tcx Region
origin: SubregionOrigin<'tcx>,
a: &'tcx Region,
b: &'tcx Region)
-> &'tcx Region
rustc_private
)fn glb_regions(&self,
origin: SubregionOrigin<'tcx>,
a: &'tcx Region,
b: &'tcx Region)
-> &'tcx Region
origin: SubregionOrigin<'tcx>,
a: &'tcx Region,
b: &'tcx Region)
-> &'tcx Region
rustc_private
)fn resolve_var(&self, rid: RegionVid) -> &'tcx Region
rustc_private
)fn opportunistic_resolve_var(&self, rid: RegionVid) -> &'tcx Region
rustc_private
)fn combine_vars<F>(&self,
t: CombineMapType,
a: &'tcx Region,
b: &'tcx Region,
origin: SubregionOrigin<'tcx>,
relate: F)
-> &'tcx Region where F: FnMut(&RegionVarBindings<'a, 'gcx, 'tcx>, &'tcx Region, &'tcx Region)
t: CombineMapType,
a: &'tcx Region,
b: &'tcx Region,
origin: SubregionOrigin<'tcx>,
relate: F)
-> &'tcx Region where F: FnMut(&RegionVarBindings<'a, 'gcx, 'tcx>, &'tcx Region, &'tcx Region)
rustc_private
)fn vars_created_since_snapshot(&self, mark: &RegionSnapshot) -> Vec<RegionVid>
rustc_private
)fn tainted(&self,
mark: &RegionSnapshot,
r0: &'tcx Region,
directions: TaintDirections)
-> FxHashSet<&'tcx Region>
mark: &RegionSnapshot,
r0: &'tcx Region,
directions: TaintDirections)
-> FxHashSet<&'tcx Region>
rustc_private
)Computes all regions that have been related to r0
since the
mark mark
was made---r0
itself will be the first
entry. The directions
parameter controls what kind of
relations are considered. For example, one can say that only
"incoming" edges to r0
are desired, in which case one will
get the set of regions {r|r <= r0}
. This is used when
checking whether skolemized regions are being improperly
related to other regions.
fn resolve_regions(&self,
free_regions: &FreeRegionMap,
subject_node: NodeId)
-> Vec<RegionResolutionError<'tcx>>
free_regions: &FreeRegionMap,
subject_node: NodeId)
-> Vec<RegionResolutionError<'tcx>>
rustc_private
)This function performs the actual region resolution. It must be called after all constraints have been added. It performs a fixed-point iteration to find region values which satisfy all constraints, assuming such values can be found; if they cannot, errors are reported.