Skip to content

Commit 688aaf3

Browse files
committed
lexical_region_resolve: rustfmt
1 parent 582a369 commit 688aaf3

File tree

1 file changed

+30
-44
lines changed
  • src/librustc/infer/lexical_region_resolve

1 file changed

+30
-44
lines changed

src/librustc/infer/lexical_region_resolve/mod.rs

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,25 @@
1010

1111
//! The code to do lexical region resolution.
1212
13-
use infer::SubregionOrigin;
14-
use infer::RegionVariableOrigin;
1513
use infer::region_constraints::Constraint;
1614
use infer::region_constraints::GenericKind;
1715
use infer::region_constraints::RegionConstraintData;
1816
use infer::region_constraints::VarInfos;
1917
use infer::region_constraints::VerifyBound;
18+
use infer::RegionVariableOrigin;
19+
use infer::SubregionOrigin;
2020
use middle::free_region::RegionRelations;
21-
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
2221
use rustc_data_structures::fx::FxHashSet;
23-
use rustc_data_structures::graph::implementation::{Graph, Direction, NodeIndex, INCOMING, OUTGOING};
22+
use rustc_data_structures::graph::implementation::{
23+
Direction, Graph, NodeIndex, INCOMING, OUTGOING,
24+
};
25+
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
2426
use std::fmt;
2527
use std::u32;
2628
use ty::{self, TyCtxt};
27-
use ty::{Region, RegionVid};
2829
use ty::{ReEarlyBound, ReEmpty, ReErased, ReFree, ReStatic};
2930
use ty::{ReLateBound, ReScope, ReSkolemized, ReVar};
31+
use ty::{Region, RegionVid};
3032

3133
mod graphviz;
3234

@@ -239,9 +241,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
239241

240242
debug!(
241243
"Expanding value of {:?} from {:?} to {:?}",
242-
b_vid,
243-
cur_region,
244-
lub
244+
b_vid, cur_region, lub
245245
);
246246

247247
*b_data = VarValue::Value(lub);
@@ -254,18 +254,17 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
254254
}
255255
}
256256

257-
258257
fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
259258
let tcx = self.region_rels.tcx;
260259
match (a, b) {
261-
(&ty::ReCanonical(..), _) |
262-
(_, &ty::ReCanonical(..)) |
263-
(&ty::ReClosureBound(..), _) |
264-
(_, &ty::ReClosureBound(..)) |
265-
(&ReLateBound(..), _) |
266-
(_, &ReLateBound(..)) |
267-
(&ReErased, _) |
268-
(_, &ReErased) => {
260+
(&ty::ReCanonical(..), _)
261+
| (_, &ty::ReCanonical(..))
262+
| (&ty::ReClosureBound(..), _)
263+
| (_, &ty::ReClosureBound(..))
264+
| (&ReLateBound(..), _)
265+
| (_, &ReLateBound(..))
266+
| (&ReErased, _)
267+
| (_, &ReErased) => {
269268
bug!("cannot relate region: LUB({:?}, {:?})", a, b);
270269
}
271270

@@ -287,10 +286,10 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
287286
);
288287
}
289288

290-
(&ReEarlyBound(_), &ReScope(s_id)) |
291-
(&ReScope(s_id), &ReEarlyBound(_)) |
292-
(&ReFree(_), &ReScope(s_id)) |
293-
(&ReScope(s_id), &ReFree(_)) => {
289+
(&ReEarlyBound(_), &ReScope(s_id))
290+
| (&ReScope(s_id), &ReEarlyBound(_))
291+
| (&ReFree(_), &ReScope(s_id))
292+
| (&ReScope(s_id), &ReFree(_)) => {
294293
// A "free" region can be interpreted as "some region
295294
// at least as big as fr.scope". So, we can
296295
// reasonably compare free regions and scopes:
@@ -332,10 +331,10 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
332331
tcx.mk_region(ReScope(lub))
333332
}
334333

335-
(&ReEarlyBound(_), &ReEarlyBound(_)) |
336-
(&ReFree(_), &ReEarlyBound(_)) |
337-
(&ReEarlyBound(_), &ReFree(_)) |
338-
(&ReFree(_), &ReFree(_)) => self.region_rels.lub_free_regions(a, b),
334+
(&ReEarlyBound(_), &ReEarlyBound(_))
335+
| (&ReFree(_), &ReEarlyBound(_))
336+
| (&ReEarlyBound(_), &ReFree(_))
337+
| (&ReFree(_), &ReFree(_)) => self.region_rels.lub_free_regions(a, b),
339338

340339
// For these types, we cannot define any additional
341340
// relationship:
@@ -358,8 +357,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
358357
for (constraint, origin) in &self.data.constraints {
359358
debug!(
360359
"collect_errors: constraint={:?} origin={:?}",
361-
constraint,
362-
origin
360+
constraint, origin
363361
);
364362
match *constraint {
365363
Constraint::RegSubVar(..) | Constraint::VarSubVar(..) => {
@@ -374,9 +372,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
374372
debug!(
375373
"collect_errors: region error at {:?}: \
376374
cannot verify that {:?} <= {:?}",
377-
origin,
378-
sub,
379-
sup
375+
origin, sub, sup
380376
);
381377

382378
errors.push(RegionResolutionError::ConcreteFailure(
@@ -402,10 +398,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
402398
debug!(
403399
"collect_errors: region error at {:?}: \
404400
cannot verify that {:?}={:?} <= {:?}",
405-
origin,
406-
a_vid,
407-
a_region,
408-
b_region
401+
origin, a_vid, a_region, b_region
409402
);
410403
*a_data = VarValue::ErrorValue;
411404
}
@@ -430,9 +423,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
430423
debug!(
431424
"collect_errors: region error at {:?}: \
432425
cannot verify that {:?} <= {:?}",
433-
verify.origin,
434-
verify.region,
435-
verify.bound
426+
verify.origin, verify.region, verify.bound
436427
);
437428

438429
errors.push(RegionResolutionError::GenericBoundFailure(
@@ -580,10 +571,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
580571
debug!(
581572
"region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
582573
sup: {:?}",
583-
origin,
584-
node_idx,
585-
lower_bound.region,
586-
upper_bound.region
574+
origin, node_idx, lower_bound.region, upper_bound.region
587575
);
588576
errors.push(RegionResolutionError::SubSupConflict(
589577
origin,
@@ -645,8 +633,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
645633

646634
debug!(
647635
"collect_concrete_regions(orig_node_idx={:?}, node_idx={:?})",
648-
orig_node_idx,
649-
node_idx
636+
orig_node_idx, node_idx
650637
);
651638

652639
process_edges(&self.data, &mut state, graph, node_idx, dir);
@@ -745,7 +732,6 @@ impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
745732
}
746733
}
747734

748-
749735
impl<'tcx> LexicalRegionResolutions<'tcx> {
750736
fn normalize(&self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
751737
match *r {

0 commit comments

Comments
 (0)