about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-09-19 12:11:58 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-09-26 09:38:26 -0400
commit688aaf3bbb62cb331d2b40beb632281e27ef40cd (patch)
tree0bd4a1f0a74a6445855ecce73b792366951d5f46 /src
parent582a369bc336b1eb3aab0cfaabf4fb4359b68492 (diff)
downloadrust-688aaf3bbb62cb331d2b40beb632281e27ef40cd.tar.gz
rust-688aaf3bbb62cb331d2b40beb632281e27ef40cd.zip
lexical_region_resolve: rustfmt
Diffstat (limited to 'src')
-rw-r--r--src/librustc/infer/lexical_region_resolve/mod.rs74
1 files changed, 30 insertions, 44 deletions
diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs
index 120b45ec01e..c7ead1cf66d 100644
--- a/src/librustc/infer/lexical_region_resolve/mod.rs
+++ b/src/librustc/infer/lexical_region_resolve/mod.rs
@@ -10,23 +10,25 @@
 
 //! The code to do lexical region resolution.
 
-use infer::SubregionOrigin;
-use infer::RegionVariableOrigin;
 use infer::region_constraints::Constraint;
 use infer::region_constraints::GenericKind;
 use infer::region_constraints::RegionConstraintData;
 use infer::region_constraints::VarInfos;
 use infer::region_constraints::VerifyBound;
+use infer::RegionVariableOrigin;
+use infer::SubregionOrigin;
 use middle::free_region::RegionRelations;
-use rustc_data_structures::indexed_vec::{Idx, IndexVec};
 use rustc_data_structures::fx::FxHashSet;
-use rustc_data_structures::graph::implementation::{Graph, Direction, NodeIndex, INCOMING, OUTGOING};
+use rustc_data_structures::graph::implementation::{
+    Direction, Graph, NodeIndex, INCOMING, OUTGOING,
+};
+use rustc_data_structures::indexed_vec::{Idx, IndexVec};
 use std::fmt;
 use std::u32;
 use ty::{self, TyCtxt};
-use ty::{Region, RegionVid};
 use ty::{ReEarlyBound, ReEmpty, ReErased, ReFree, ReStatic};
 use ty::{ReLateBound, ReScope, ReSkolemized, ReVar};
+use ty::{Region, RegionVid};
 
 mod graphviz;
 
@@ -239,9 +241,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
 
                 debug!(
                     "Expanding value of {:?} from {:?} to {:?}",
-                    b_vid,
-                    cur_region,
-                    lub
+                    b_vid, cur_region, lub
                 );
 
                 *b_data = VarValue::Value(lub);
@@ -254,18 +254,17 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
         }
     }
 
-
     fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
         let tcx = self.region_rels.tcx;
         match (a, b) {
-            (&ty::ReCanonical(..), _) |
-            (_, &ty::ReCanonical(..)) |
-            (&ty::ReClosureBound(..), _) |
-            (_, &ty::ReClosureBound(..)) |
-            (&ReLateBound(..), _) |
-            (_, &ReLateBound(..)) |
-            (&ReErased, _) |
-            (_, &ReErased) => {
+            (&ty::ReCanonical(..), _)
+            | (_, &ty::ReCanonical(..))
+            | (&ty::ReClosureBound(..), _)
+            | (_, &ty::ReClosureBound(..))
+            | (&ReLateBound(..), _)
+            | (_, &ReLateBound(..))
+            | (&ReErased, _)
+            | (_, &ReErased) => {
                 bug!("cannot relate region: LUB({:?}, {:?})", a, b);
             }
 
@@ -287,10 +286,10 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
                 );
             }
 
-            (&ReEarlyBound(_), &ReScope(s_id)) |
-            (&ReScope(s_id), &ReEarlyBound(_)) |
-            (&ReFree(_), &ReScope(s_id)) |
-            (&ReScope(s_id), &ReFree(_)) => {
+            (&ReEarlyBound(_), &ReScope(s_id))
+            | (&ReScope(s_id), &ReEarlyBound(_))
+            | (&ReFree(_), &ReScope(s_id))
+            | (&ReScope(s_id), &ReFree(_)) => {
                 // A "free" region can be interpreted as "some region
                 // at least as big as fr.scope".  So, we can
                 // reasonably compare free regions and scopes:
@@ -332,10 +331,10 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
                 tcx.mk_region(ReScope(lub))
             }
 
-            (&ReEarlyBound(_), &ReEarlyBound(_)) |
-            (&ReFree(_), &ReEarlyBound(_)) |
-            (&ReEarlyBound(_), &ReFree(_)) |
-            (&ReFree(_), &ReFree(_)) => self.region_rels.lub_free_regions(a, b),
+            (&ReEarlyBound(_), &ReEarlyBound(_))
+            | (&ReFree(_), &ReEarlyBound(_))
+            | (&ReEarlyBound(_), &ReFree(_))
+            | (&ReFree(_), &ReFree(_)) => self.region_rels.lub_free_regions(a, b),
 
             // For these types, we cannot define any additional
             // relationship:
@@ -358,8 +357,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
         for (constraint, origin) in &self.data.constraints {
             debug!(
                 "collect_errors: constraint={:?} origin={:?}",
-                constraint,
-                origin
+                constraint, origin
             );
             match *constraint {
                 Constraint::RegSubVar(..) | Constraint::VarSubVar(..) => {
@@ -374,9 +372,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
                     debug!(
                         "collect_errors: region error at {:?}: \
                          cannot verify that {:?} <= {:?}",
-                        origin,
-                        sub,
-                        sup
+                        origin, sub, sup
                     );
 
                     errors.push(RegionResolutionError::ConcreteFailure(
@@ -402,10 +398,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
                         debug!(
                             "collect_errors: region error at {:?}: \
                              cannot verify that {:?}={:?} <= {:?}",
-                            origin,
-                            a_vid,
-                            a_region,
-                            b_region
+                            origin, a_vid, a_region, b_region
                         );
                         *a_data = VarValue::ErrorValue;
                     }
@@ -430,9 +423,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
             debug!(
                 "collect_errors: region error at {:?}: \
                  cannot verify that {:?} <= {:?}",
-                verify.origin,
-                verify.region,
-                verify.bound
+                verify.origin, verify.region, verify.bound
             );
 
             errors.push(RegionResolutionError::GenericBoundFailure(
@@ -580,10 +571,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
                     debug!(
                         "region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
                          sup: {:?}",
-                        origin,
-                        node_idx,
-                        lower_bound.region,
-                        upper_bound.region
+                        origin, node_idx, lower_bound.region, upper_bound.region
                     );
                     errors.push(RegionResolutionError::SubSupConflict(
                         origin,
@@ -645,8 +633,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
 
             debug!(
                 "collect_concrete_regions(orig_node_idx={:?}, node_idx={:?})",
-                orig_node_idx,
-                node_idx
+                orig_node_idx, node_idx
             );
 
             process_edges(&self.data, &mut state, graph, node_idx, dir);
@@ -745,7 +732,6 @@ impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
     }
 }
 
-
 impl<'tcx> LexicalRegionResolutions<'tcx> {
     fn normalize(&self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
         match *r {