Skip to content

Commit 71f25b4

Browse files
committed
Run rustfmt
1 parent 0957ede commit 71f25b4

File tree

4 files changed

+40
-58
lines changed

4 files changed

+40
-58
lines changed

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

+20-32
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc::infer::NLLRegionVariableOrigin;
1919
use rustc::infer::RegionVariableOrigin;
2020
use rustc::mir::{
2121
ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements, Local, Location,
22-
Mir
22+
Mir,
2323
};
2424
use rustc::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable};
2525
use rustc::util::common;
@@ -271,17 +271,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
271271

272272
// Add all nodes in the CFG to liveness constraints
273273
for point_index in self.elements.all_point_indices() {
274-
self.liveness_constraints.add_element(
275-
variable,
276-
point_index,
277-
);
274+
self.liveness_constraints.add_element(variable, point_index);
278275
}
279276

280277
// Add `end(X)` into the set for X.
281-
self.liveness_constraints.add_element(
282-
variable,
283-
variable,
284-
);
278+
self.liveness_constraints.add_element(variable, variable);
285279
}
286280
}
287281

@@ -335,12 +329,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
335329
}
336330

337331
/// Indicates that the region variable `sup` must outlive `sub` is live at the point `point`.
338-
pub(super) fn add_outlives(
339-
&mut self,
340-
locations: Locations,
341-
sup: RegionVid,
342-
sub: RegionVid,
343-
) {
332+
pub(super) fn add_outlives(&mut self, locations: Locations, sup: RegionVid, sub: RegionVid) {
344333
assert!(self.inferred_values.is_none(), "values already inferred");
345334
self.constraints.push(OutlivesConstraint {
346335
locations,
@@ -445,11 +434,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
445434
debug!("propagate_constraints: sub={:?}", constraint.sub);
446435
debug!("propagate_constraints: sup={:?}", constraint.sup);
447436

448-
self.constraints.each_affected_by_dirty(dependency_map[constraint.sup], |dep_idx| {
449-
if clean_bit_vec.remove(dep_idx.index()) {
450-
dirty_list.push(dep_idx);
451-
}
452-
});
437+
self.constraints.each_affected_by_dirty(
438+
dependency_map[constraint.sup],
439+
|dep_idx| {
440+
if clean_bit_vec.remove(dep_idx.index()) {
441+
dirty_list.push(dep_idx);
442+
}
443+
},
444+
);
453445
}
454446

455447
debug!("\n");
@@ -487,8 +479,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
487479
}
488480

489481
if let Some(propagated_outlives_requirements) = &mut propagated_outlives_requirements {
490-
if self.try_promote_type_test(infcx, mir, type_test,
491-
propagated_outlives_requirements) {
482+
if self.try_promote_type_test(
483+
infcx,
484+
mir,
485+
type_test,
486+
propagated_outlives_requirements,
487+
) {
492488
continue;
493489
}
494490
}
@@ -744,12 +740,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
744740

745741
/// Test if `test` is true when applied to `lower_bound` at
746742
/// `point`, and returns true or false.
747-
fn eval_region_test(
748-
&self,
749-
mir: &Mir<'tcx>,
750-
lower_bound: RegionVid,
751-
test: &RegionTest,
752-
) -> bool {
743+
fn eval_region_test(&self, mir: &Mir<'tcx>, lower_bound: RegionVid, test: &RegionTest) -> bool {
753744
debug!(
754745
"eval_region_test(lower_bound={:?}, test={:?})",
755746
lower_bound, test
@@ -781,10 +772,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
781772
sup_region: RegionVid,
782773
sub_region: RegionVid,
783774
) -> bool {
784-
debug!(
785-
"eval_outlives({:?}: {:?})",
786-
sup_region, sub_region
787-
);
775+
debug!("eval_outlives({:?}: {:?})", sup_region, sub_region);
788776

789777
let inferred_values = self
790778
.inferred_values

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

+5-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ pub(super) struct RegionValueElements {
2828
impl RegionValueElements {
2929
pub(super) fn new(mir: &Mir<'_>, num_universal_regions: usize) -> Self {
3030
let mut num_points = 0;
31-
let statements_before_block = mir.basic_blocks()
31+
let statements_before_block = mir
32+
.basic_blocks()
3233
.iter()
3334
.map(|block_data| {
3435
let v = num_points;
@@ -96,7 +97,8 @@ impl RegionValueElements {
9697
// be (BB2, 20).
9798
//
9899
// Nit: we could do a binary search here but I'm too lazy.
99-
let (block, &first_index) = self.statements_before_block
100+
let (block, &first_index) = self
101+
.statements_before_block
100102
.iter_enumerated()
101103
.filter(|(_, first_index)| **first_index <= point_index)
102104
.last()
@@ -203,11 +205,7 @@ impl RegionValues {
203205

204206
/// Adds the given element to the value for the given region. Returns true if
205207
/// the element is newly added (i.e., was not already present).
206-
pub(super) fn add_element<E: ToElementIndex>(
207-
&mut self,
208-
r: RegionVid,
209-
elem: E,
210-
) -> bool {
208+
pub(super) fn add_element<E: ToElementIndex>(&mut self, r: RegionVid, elem: E) -> bool {
211209
let i = self.elements.index(elem);
212210
debug!("add(r={:?}, elem={:?})", r, elem);
213211
self.matrix.add(r, i)

src/librustc_mir/borrow_check/nll/type_check/liveness.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flo
168168
);
169169

170170
cx.tcx().for_each_free_region(&value, |live_region| {
171-
cx.constraints
172-
.liveness_set
173-
.push((live_region, location));
171+
cx.constraints.liveness_set.push((live_region, location));
174172
});
175173
}
176174

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

+14-16
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,10 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
311311

312312
debug!("sanitize_constant: expected_ty={:?}", expected_ty);
313313

314-
if let Err(terr) = self.cx.eq_types(expected_ty, constant.ty, location.boring()) {
314+
if let Err(terr) = self
315+
.cx
316+
.eq_types(expected_ty, constant.ty, location.boring())
317+
{
315318
span_mirbug!(
316319
self,
317320
constant,
@@ -770,12 +773,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
770773
}
771774
}
772775

773-
fn sub_types(
774-
&mut self,
775-
sub: Ty<'tcx>,
776-
sup: Ty<'tcx>,
777-
locations: Locations,
778-
) -> Fallible<()> {
776+
fn sub_types(&mut self, sub: Ty<'tcx>, sup: Ty<'tcx>, locations: Locations) -> Fallible<()> {
779777
let param_env = self.param_env;
780778
self.fully_perform_op(
781779
locations,
@@ -807,7 +805,11 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
807805
false
808806
};
809807

810-
let locations = if is_temp { location.boring() } else { location.interesting() };
808+
let locations = if is_temp {
809+
location.boring()
810+
} else {
811+
location.interesting()
812+
};
811813

812814
let place_ty = place.ty(mir, tcx).to_ty(tcx);
813815
let rv_ty = rv.ty(mir, tcx);
@@ -982,10 +984,9 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
982984
// output) types in the signature must be live, since
983985
// all the inputs that fed into it were live.
984986
for &late_bound_region in map.values() {
985-
self.constraints.liveness_set.push((
986-
late_bound_region,
987-
term_location,
988-
));
987+
self.constraints
988+
.liveness_set
989+
.push((late_bound_region, term_location));
989990
}
990991

991992
self.check_call_inputs(mir, term, &sig, args, term_location);
@@ -1505,10 +1506,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
15051506
);
15061507

15071508
// Hmm, are these constraints *really* boring?
1508-
self.push_region_constraints(
1509-
location.boring(),
1510-
&closure_constraints,
1511-
);
1509+
self.push_region_constraints(location.boring(), &closure_constraints);
15121510
}
15131511

15141512
tcx.predicates_of(*def_id).instantiate(tcx, substs.substs)

0 commit comments

Comments
 (0)