Skip to content

Commit 411422f

Browse files
committed
Remove impl ToRegionVid for RegionVid.
It's weird and unnecessary.
1 parent c802694 commit 411422f

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ use rustc_mir_dataflow::{self, fmt::DebugWithContext, CallReturnPlaces, GenKill}
1111
use rustc_mir_dataflow::{Analysis, Direction, Results};
1212
use std::fmt;
1313

14-
use crate::{
15-
places_conflict, BorrowSet, PlaceConflictBias, PlaceExt, RegionInferenceContext, ToRegionVid,
16-
};
14+
use crate::{places_conflict, BorrowSet, PlaceConflictBias, PlaceExt, RegionInferenceContext};
1715

1816
/// A tuple with named fields that can hold either the results or the transient state of the
1917
/// dataflow analyses used by the borrow checker.
@@ -242,7 +240,7 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
242240
) -> Self {
243241
let mut prec = OutOfScopePrecomputer::new(body, nonlexical_regioncx);
244242
for (borrow_index, borrow_data) in borrow_set.iter_enumerated() {
245-
let borrow_region = borrow_data.region.to_region_vid();
243+
let borrow_region = borrow_data.region;
246244
let location = borrow_data.reserve_location;
247245

248246
prec.precompute_borrows_out_of_scope(borrow_index, borrow_region, location);

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub mod consumers;
9494

9595
use borrow_set::{BorrowData, BorrowSet};
9696
use dataflow::{BorrowIndex, BorrowckFlowState as Flows, BorrowckResults, Borrows};
97-
use nll::{PoloniusOutput, ToRegionVid};
97+
use nll::PoloniusOutput;
9898
use place_ext::PlaceExt;
9999
use places_conflict::{places_conflict, PlaceConflictBias};
100100
use region_infer::RegionInferenceContext;

compiler/rustc_borrowck/src/nll.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,12 +459,6 @@ impl<'tcx> ToRegionVid for Region<'tcx> {
459459
}
460460
}
461461

462-
impl ToRegionVid for RegionVid {
463-
fn to_region_vid(self) -> RegionVid {
464-
self
465-
}
466-
}
467-
468462
pub(crate) trait ConstraintDescription {
469463
fn description(&self) -> &'static str;
470464
}

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
},
2828
diagnostics::{RegionErrorKind, RegionErrors, UniverseInfo},
2929
member_constraints::{MemberConstraintSet, NllMemberConstraintIndex},
30-
nll::{PoloniusOutput, ToRegionVid},
30+
nll::PoloniusOutput,
3131
region_infer::reverse_sccs::ReverseSccGraph,
3232
region_infer::values::{
3333
LivenessValues, PlaceholderIndices, RegionElement, RegionValueElements, RegionValues,
@@ -593,39 +593,36 @@ impl<'tcx> RegionInferenceContext<'tcx> {
593593
/// Returns `true` if the region `r` contains the point `p`.
594594
///
595595
/// Panics if called before `solve()` executes,
596-
pub(crate) fn region_contains(&self, r: impl ToRegionVid, p: impl ToElementIndex) -> bool {
597-
let scc = self.constraint_sccs.scc(r.to_region_vid());
596+
pub(crate) fn region_contains(&self, r: RegionVid, p: impl ToElementIndex) -> bool {
597+
let scc = self.constraint_sccs.scc(r);
598598
self.scc_values.contains(scc, p)
599599
}
600600

601601
/// Returns access to the value of `r` for debugging purposes.
602602
pub(crate) fn region_value_str(&self, r: RegionVid) -> String {
603-
let scc = self.constraint_sccs.scc(r.to_region_vid());
603+
let scc = self.constraint_sccs.scc(r);
604604
self.scc_values.region_value_str(scc)
605605
}
606606

607607
pub(crate) fn placeholders_contained_in<'a>(
608608
&'a self,
609609
r: RegionVid,
610610
) -> impl Iterator<Item = ty::PlaceholderRegion> + 'a {
611-
let scc = self.constraint_sccs.scc(r.to_region_vid());
611+
let scc = self.constraint_sccs.scc(r);
612612
self.scc_values.placeholders_contained_in(scc)
613613
}
614614

615615
/// Returns access to the value of `r` for debugging purposes.
616616
pub(crate) fn region_universe(&self, r: RegionVid) -> ty::UniverseIndex {
617-
let scc = self.constraint_sccs.scc(r.to_region_vid());
617+
let scc = self.constraint_sccs.scc(r);
618618
self.scc_universes[scc]
619619
}
620620

621621
/// Once region solving has completed, this function will return
622622
/// the member constraints that were applied to the value of a given
623623
/// region `r`. See `AppliedMemberConstraint`.
624-
pub(crate) fn applied_member_constraints(
625-
&self,
626-
r: impl ToRegionVid,
627-
) -> &[AppliedMemberConstraint] {
628-
let scc = self.constraint_sccs.scc(r.to_region_vid());
624+
pub(crate) fn applied_member_constraints(&self, r: RegionVid) -> &[AppliedMemberConstraint] {
625+
let scc = self.constraint_sccs.scc(r);
629626
binary_search_util::binary_search_slice(
630627
&self.member_constraints_applied,
631628
|applied| applied.member_region_scc,
@@ -2234,7 +2231,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
22342231
r: RegionVid,
22352232
body: &Body<'_>,
22362233
) -> Option<Location> {
2237-
let scc = self.constraint_sccs.scc(r.to_region_vid());
2234+
let scc = self.constraint_sccs.scc(r);
22382235
let locations = self.scc_values.locations_outlived_by(scc);
22392236
for location in locations {
22402237
let bb = &body[location.block];

0 commit comments

Comments
 (0)