Remove impl ToRegionVid for RegionVid
.
It's weird and unnecessary.
This commit is contained in:
parent
c802694bda
commit
411422f2b9
@ -11,9 +11,7 @@ use rustc_mir_dataflow::{self, fmt::DebugWithContext, CallReturnPlaces, GenKill}
|
||||
use rustc_mir_dataflow::{Analysis, Direction, Results};
|
||||
use std::fmt;
|
||||
|
||||
use crate::{
|
||||
places_conflict, BorrowSet, PlaceConflictBias, PlaceExt, RegionInferenceContext, ToRegionVid,
|
||||
};
|
||||
use crate::{places_conflict, BorrowSet, PlaceConflictBias, PlaceExt, RegionInferenceContext};
|
||||
|
||||
/// A tuple with named fields that can hold either the results or the transient state of the
|
||||
/// dataflow analyses used by the borrow checker.
|
||||
@ -242,7 +240,7 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
|
||||
) -> Self {
|
||||
let mut prec = OutOfScopePrecomputer::new(body, nonlexical_regioncx);
|
||||
for (borrow_index, borrow_data) in borrow_set.iter_enumerated() {
|
||||
let borrow_region = borrow_data.region.to_region_vid();
|
||||
let borrow_region = borrow_data.region;
|
||||
let location = borrow_data.reserve_location;
|
||||
|
||||
prec.precompute_borrows_out_of_scope(borrow_index, borrow_region, location);
|
||||
|
@ -94,7 +94,7 @@ pub mod consumers;
|
||||
|
||||
use borrow_set::{BorrowData, BorrowSet};
|
||||
use dataflow::{BorrowIndex, BorrowckFlowState as Flows, BorrowckResults, Borrows};
|
||||
use nll::{PoloniusOutput, ToRegionVid};
|
||||
use nll::PoloniusOutput;
|
||||
use place_ext::PlaceExt;
|
||||
use places_conflict::{places_conflict, PlaceConflictBias};
|
||||
use region_infer::RegionInferenceContext;
|
||||
|
@ -459,12 +459,6 @@ impl<'tcx> ToRegionVid for Region<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToRegionVid for RegionVid {
|
||||
fn to_region_vid(self) -> RegionVid {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait ConstraintDescription {
|
||||
fn description(&self) -> &'static str;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ use crate::{
|
||||
},
|
||||
diagnostics::{RegionErrorKind, RegionErrors, UniverseInfo},
|
||||
member_constraints::{MemberConstraintSet, NllMemberConstraintIndex},
|
||||
nll::{PoloniusOutput, ToRegionVid},
|
||||
nll::PoloniusOutput,
|
||||
region_infer::reverse_sccs::ReverseSccGraph,
|
||||
region_infer::values::{
|
||||
LivenessValues, PlaceholderIndices, RegionElement, RegionValueElements, RegionValues,
|
||||
@ -593,14 +593,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
/// Returns `true` if the region `r` contains the point `p`.
|
||||
///
|
||||
/// Panics if called before `solve()` executes,
|
||||
pub(crate) fn region_contains(&self, r: impl ToRegionVid, p: impl ToElementIndex) -> bool {
|
||||
let scc = self.constraint_sccs.scc(r.to_region_vid());
|
||||
pub(crate) fn region_contains(&self, r: RegionVid, p: impl ToElementIndex) -> bool {
|
||||
let scc = self.constraint_sccs.scc(r);
|
||||
self.scc_values.contains(scc, p)
|
||||
}
|
||||
|
||||
/// Returns access to the value of `r` for debugging purposes.
|
||||
pub(crate) fn region_value_str(&self, r: RegionVid) -> String {
|
||||
let scc = self.constraint_sccs.scc(r.to_region_vid());
|
||||
let scc = self.constraint_sccs.scc(r);
|
||||
self.scc_values.region_value_str(scc)
|
||||
}
|
||||
|
||||
@ -608,24 +608,21 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
&'a self,
|
||||
r: RegionVid,
|
||||
) -> impl Iterator<Item = ty::PlaceholderRegion> + 'a {
|
||||
let scc = self.constraint_sccs.scc(r.to_region_vid());
|
||||
let scc = self.constraint_sccs.scc(r);
|
||||
self.scc_values.placeholders_contained_in(scc)
|
||||
}
|
||||
|
||||
/// Returns access to the value of `r` for debugging purposes.
|
||||
pub(crate) fn region_universe(&self, r: RegionVid) -> ty::UniverseIndex {
|
||||
let scc = self.constraint_sccs.scc(r.to_region_vid());
|
||||
let scc = self.constraint_sccs.scc(r);
|
||||
self.scc_universes[scc]
|
||||
}
|
||||
|
||||
/// Once region solving has completed, this function will return
|
||||
/// the member constraints that were applied to the value of a given
|
||||
/// region `r`. See `AppliedMemberConstraint`.
|
||||
pub(crate) fn applied_member_constraints(
|
||||
&self,
|
||||
r: impl ToRegionVid,
|
||||
) -> &[AppliedMemberConstraint] {
|
||||
let scc = self.constraint_sccs.scc(r.to_region_vid());
|
||||
pub(crate) fn applied_member_constraints(&self, r: RegionVid) -> &[AppliedMemberConstraint] {
|
||||
let scc = self.constraint_sccs.scc(r);
|
||||
binary_search_util::binary_search_slice(
|
||||
&self.member_constraints_applied,
|
||||
|applied| applied.member_region_scc,
|
||||
@ -2234,7 +2231,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
r: RegionVid,
|
||||
body: &Body<'_>,
|
||||
) -> Option<Location> {
|
||||
let scc = self.constraint_sccs.scc(r.to_region_vid());
|
||||
let scc = self.constraint_sccs.scc(r);
|
||||
let locations = self.scc_values.locations_outlived_by(scc);
|
||||
for location in locations {
|
||||
let bb = &body[location.block];
|
||||
|
Loading…
x
Reference in New Issue
Block a user