]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/borrow_check/constraints/graph.rs
Auto merge of #69076 - cjgillot:split_trait, r=matthewjasper
[rust.git] / src / librustc_mir / borrow_check / constraints / graph.rs
index 3e7aa67ef6c7de3c85814e4ec1957fa5626d19df..c60a11e348d70e2634a840d3978e7e0ce0329d33 100644 (file)
@@ -2,12 +2,12 @@
 use rustc::ty::RegionVid;
 use rustc_data_structures::graph;
 use rustc_index::vec::IndexVec;
-use syntax_pos::DUMMY_SP;
+use rustc_span::DUMMY_SP;
 
 use crate::borrow_check::{
-    type_check::Locations,
     constraints::OutlivesConstraintIndex,
-    constraints::{OutlivesConstraintSet, OutlivesConstraint},
+    constraints::{OutlivesConstraint, OutlivesConstraintSet},
+    type_check::Locations,
 };
 
 /// The construct graph organizes the constraints by their end-points.
@@ -78,11 +78,7 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
     /// R2` is treated as an edge `R1 -> R2`. We use this graph to
     /// construct SCCs for region inference but also for error
     /// reporting.
-    crate fn new(
-        direction: D,
-        set: &OutlivesConstraintSet,
-        num_region_vars: usize,
-    ) -> Self {
+    crate fn new(direction: D, set: &OutlivesConstraintSet, num_region_vars: usize) -> Self {
         let mut first_constraints = IndexVec::from_elem_n(None, num_region_vars);
         let mut next_constraints = IndexVec::from_elem(None, &set.outlives);
 
@@ -94,11 +90,7 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
             *head = Some(idx);
         }
 
-        Self {
-            _direction: direction,
-            first_constraints,
-            next_constraints,
-        }
+        Self { _direction: direction, first_constraints, next_constraints }
     }
 
     /// Given the constraint set from which this graph was built
@@ -132,13 +124,7 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
         } else {
             //otherwise, just setup the iterator as normal
             let first = self.first_constraints[region_sup];
-            Edges {
-                graph: self,
-                constraints,
-                pointer: first,
-                next_static_idx: None,
-                static_region,
-           }
+            Edges { graph: self, constraints, pointer: first, next_static_idx: None, static_region }
         }
     }
 }
@@ -160,12 +146,11 @@ fn next(&mut self) -> Option<Self::Item> {
 
             Some(self.constraints[p])
         } else if let Some(next_static_idx) = self.next_static_idx {
-            self.next_static_idx =
-                if next_static_idx == (self.graph.first_constraints.len() - 1) {
-                    None
-                } else {
-                    Some(next_static_idx + 1)
-                };
+            self.next_static_idx = if next_static_idx == (self.graph.first_constraints.len() - 1) {
+                None
+            } else {
+                Some(next_static_idx + 1)
+            };
 
             Some(OutlivesConstraint {
                 sup: self.static_region,
@@ -198,11 +183,7 @@ impl<'s, D: ConstraintGraphDirecton> RegionGraph<'s, D> {
         constraint_graph: &'s ConstraintGraph<D>,
         static_region: RegionVid,
     ) -> Self {
-        Self {
-            set,
-            constraint_graph,
-            static_region,
-        }
+        Self { set, constraint_graph, static_region }
     }
 
     /// Given a region `R`, iterate over all regions `R1` such that
@@ -237,10 +218,7 @@ fn num_nodes(&self) -> usize {
 }
 
 impl<'s, D: ConstraintGraphDirecton> graph::WithSuccessors for RegionGraph<'s, D> {
-    fn successors(
-        &self,
-        node: Self::Node,
-    ) -> <Self as graph::GraphSuccessors<'_>>::Iter {
+    fn successors(&self, node: Self::Node) -> <Self as graph::GraphSuccessors<'_>>::Iter {
         self.outgoing_regions(node)
     }
 }