Skip to content

Commit 60bf07a

Browse files
committed
Adjust ConstraintGraphDirection methods.
This facilitates the next commit.
1 parent 00f2459 commit 60bf07a

File tree

1 file changed

+12
-12
lines changed
  • compiler/rustc_borrowck/src/constraints

1 file changed

+12
-12
lines changed

Diff for: compiler/rustc_borrowck/src/constraints/graph.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ pub(crate) type ReverseConstraintGraph = ConstraintGraph<Reverse>;
2323
/// Marker trait that controls whether a `R1: R2` constraint
2424
/// represents an edge `R1 -> R2` or `R2 -> R1`.
2525
pub(crate) trait ConstraintGraphDirection: Copy + 'static {
26-
fn start_region(c: &OutlivesConstraint<'_>) -> RegionVid;
27-
fn end_region(c: &OutlivesConstraint<'_>) -> RegionVid;
26+
fn start_region(sup: RegionVid, sub: RegionVid) -> RegionVid;
27+
fn end_region(sup: RegionVid, sub: RegionVid) -> RegionVid;
2828
fn is_normal() -> bool;
2929
}
3030

@@ -36,12 +36,12 @@ pub(crate) trait ConstraintGraphDirection: Copy + 'static {
3636
pub(crate) struct Normal;
3737

3838
impl ConstraintGraphDirection for Normal {
39-
fn start_region(c: &OutlivesConstraint<'_>) -> RegionVid {
40-
c.sup
39+
fn start_region(sup: RegionVid, _sub: RegionVid) -> RegionVid {
40+
sup
4141
}
4242

43-
fn end_region(c: &OutlivesConstraint<'_>) -> RegionVid {
44-
c.sub
43+
fn end_region(_sup: RegionVid, sub: RegionVid) -> RegionVid {
44+
sub
4545
}
4646

4747
fn is_normal() -> bool {
@@ -57,12 +57,12 @@ impl ConstraintGraphDirection for Normal {
5757
pub(crate) struct Reverse;
5858

5959
impl ConstraintGraphDirection for Reverse {
60-
fn start_region(c: &OutlivesConstraint<'_>) -> RegionVid {
61-
c.sub
60+
fn start_region(_sup: RegionVid, sub: RegionVid) -> RegionVid {
61+
sub
6262
}
6363

64-
fn end_region(c: &OutlivesConstraint<'_>) -> RegionVid {
65-
c.sup
64+
fn end_region(sup: RegionVid, _sub: RegionVid) -> RegionVid {
65+
sup
6666
}
6767

6868
fn is_normal() -> bool {
@@ -84,7 +84,7 @@ impl<D: ConstraintGraphDirection> ConstraintGraph<D> {
8484
let mut next_constraints = IndexVec::from_elem(None, &set.outlives);
8585

8686
for (idx, constraint) in set.outlives.iter_enumerated().rev() {
87-
let head = &mut first_constraints[D::start_region(constraint)];
87+
let head = &mut first_constraints[D::start_region(constraint.sup, constraint.sub)];
8888
let next = &mut next_constraints[idx];
8989
debug_assert!(next.is_none());
9090
*next = *head;
@@ -207,7 +207,7 @@ impl<'a, 'tcx, D: ConstraintGraphDirection> Iterator for Successors<'a, 'tcx, D>
207207
type Item = RegionVid;
208208

209209
fn next(&mut self) -> Option<Self::Item> {
210-
self.edges.next().map(|c| D::end_region(&c))
210+
self.edges.next().map(|c| D::end_region(c.sup, c.sub))
211211
}
212212
}
213213

0 commit comments

Comments
 (0)