Skip to content

Commit b9652ae

Browse files
nikomatsakispnkfelix
authored andcommitted
region_infer: rustfmt, pacifying the mercilous tidy
1 parent 9baf013 commit b9652ae

File tree

1 file changed

+48
-24
lines changed
  • src/librustc_mir/borrow_check/nll/region_infer

1 file changed

+48
-24
lines changed

src/librustc_mir/borrow_check/nll/region_infer/mod.rs

+48-24
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use borrow_check::nll::constraints::{
1414
ConstraintIndex, ConstraintSccIndex, ConstraintSet, OutlivesConstraint,
1515
};
1616
use borrow_check::nll::region_infer::values::{RegionElement, ToElementIndex};
17-
use borrow_check::nll::type_check::Locations;
1817
use borrow_check::nll::type_check::free_region_relations::UniversalRegionRelations;
18+
use borrow_check::nll::type_check::Locations;
1919
use rustc::hir::def_id::DefId;
2020
use rustc::infer::canonical::QueryRegionConstraint;
2121
use rustc::infer::region_constraints::{GenericKind, VarInfos};
@@ -313,8 +313,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
313313
for (external_name, variable) in self.universal_regions.named_universal_regions() {
314314
debug!(
315315
"init_universal_regions: region {:?} has external name {:?}",
316-
variable,
317-
external_name
316+
variable, external_name
318317
);
319318
self.definitions[variable].external_name = Some(external_name);
320319
}
@@ -424,10 +423,20 @@ impl<'tcx> RegionInferenceContext<'tcx> {
424423
};
425424

426425
self.check_type_tests(
427-
infcx, mir, mir_def_id, outlives_requirements.as_mut(), errors_buffer);
426+
infcx,
427+
mir,
428+
mir_def_id,
429+
outlives_requirements.as_mut(),
430+
errors_buffer,
431+
);
428432

429433
self.check_universal_regions(
430-
infcx, mir, mir_def_id, outlives_requirements.as_mut(), errors_buffer);
434+
infcx,
435+
mir,
436+
mir_def_id,
437+
outlives_requirements.as_mut(),
438+
errors_buffer,
439+
);
431440

432441
let outlives_requirements = outlives_requirements.unwrap_or(vec![]);
433442

@@ -586,13 +595,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
586595
if let Some(lower_bound_region) = lower_bound_region {
587596
let region_scope_tree = &tcx.region_scope_tree(mir_def_id);
588597
let type_test_span = type_test.locations.span(mir);
589-
infcx.construct_generic_bound_failure(
590-
region_scope_tree,
591-
type_test_span,
592-
None,
593-
type_test.generic_kind,
594-
lower_bound_region,
595-
).buffer(errors_buffer);
598+
infcx
599+
.construct_generic_bound_failure(
600+
region_scope_tree,
601+
type_test_span,
602+
None,
603+
type_test.generic_kind,
604+
lower_bound_region,
605+
)
606+
.buffer(errors_buffer);
596607
} else {
597608
// FIXME. We should handle this case better. It
598609
// indicates that we have e.g. some region variable
@@ -604,10 +615,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
604615
// iterating over the universal regions and reporting
605616
// an error that multiple bounds are required.
606617
let type_test_span = type_test.locations.span(mir);
607-
tcx.sess.struct_span_err(
608-
type_test_span,
609-
&format!("`{}` does not live long enough", type_test.generic_kind,),
610-
).buffer(errors_buffer);
618+
tcx.sess
619+
.struct_span_err(
620+
type_test_span,
621+
&format!("`{}` does not live long enough", type_test.generic_kind,),
622+
)
623+
.buffer(errors_buffer);
611624
}
612625
}
613626
}
@@ -659,8 +672,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
659672
// region, which ensures it can be encoded in a `ClosureOutlivesRequirement`.
660673
let lower_bound_plus = self.non_local_universal_upper_bound(*lower_bound);
661674
assert!(self.universal_regions.is_universal_region(lower_bound_plus));
662-
assert!(!self.universal_regions
663-
.is_local_free_region(lower_bound_plus));
675+
assert!(
676+
!self
677+
.universal_regions
678+
.is_local_free_region(lower_bound_plus)
679+
);
664680

665681
propagated_outlives_requirements.push(ClosureOutlivesRequirement {
666682
subject,
@@ -892,7 +908,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
892908
return true;
893909
}
894910

895-
self.scc_values.contains_points(sup_region_scc, sub_region_scc)
911+
self.scc_values
912+
.contains_points(sup_region_scc, sub_region_scc)
896913
}
897914

898915
/// Once regions have been propagated, this method is used to see
@@ -982,7 +999,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
982999
// (because `fr` includes `end(o)`).
9831000
for shorter_fr in self.scc_values.universal_regions_outlived_by(longer_fr_scc) {
9841001
// If it is known that `fr: o`, carry on.
985-
if self.universal_region_relations.outlives(longer_fr, shorter_fr) {
1002+
if self
1003+
.universal_region_relations
1004+
.outlives(longer_fr, shorter_fr)
1005+
{
9861006
continue;
9871007
}
9881008

@@ -996,14 +1016,19 @@ impl<'tcx> RegionInferenceContext<'tcx> {
9961016
if let Some(propagated_outlives_requirements) = propagated_outlives_requirements {
9971017
// Shrink `fr` until we find a non-local region (if we do).
9981018
// We'll call that `fr-` -- it's ever so slightly smaller than `fr`.
999-
if let Some(fr_minus) = self.universal_region_relations.non_local_lower_bound(longer_fr) {
1019+
if let Some(fr_minus) = self
1020+
.universal_region_relations
1021+
.non_local_lower_bound(longer_fr)
1022+
{
10001023
debug!("check_universal_region: fr_minus={:?}", fr_minus);
10011024

10021025
// Grow `shorter_fr` until we find a non-local
10031026
// region. (We always will.) We'll call that
10041027
// `shorter_fr+` -- it's ever so slightly larger than
10051028
// `fr`.
1006-
let shorter_fr_plus = self.universal_region_relations.non_local_upper_bound(shorter_fr);
1029+
let shorter_fr_plus = self
1030+
.universal_region_relations
1031+
.non_local_upper_bound(shorter_fr);
10071032
debug!(
10081033
"check_universal_region: shorter_fr_plus={:?}",
10091034
shorter_fr_plus
@@ -1026,8 +1051,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10261051
// Note: in this case, we use the unapproximated regions
10271052
// to report the error. This gives better error messages
10281053
// in some cases.
1029-
self.report_error(
1030-
mir, infcx, mir_def_id, longer_fr, shorter_fr, errors_buffer);
1054+
self.report_error(mir, infcx, mir_def_id, longer_fr, shorter_fr, errors_buffer);
10311055
}
10321056
}
10331057

0 commit comments

Comments
 (0)