Run rustfmt

上级 0957ede5
......@@ -19,7 +19,7 @@
use rustc::infer::RegionVariableOrigin;
use rustc::mir::{
ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements, Local, Location,
Mir
Mir,
};
use rustc::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable};
use rustc::util::common;
......@@ -271,17 +271,11 @@ fn init_universal_regions(&mut self) {
// Add all nodes in the CFG to liveness constraints
for point_index in self.elements.all_point_indices() {
self.liveness_constraints.add_element(
variable,
point_index,
);
self.liveness_constraints.add_element(variable, point_index);
}
// Add `end(X)` into the set for X.
self.liveness_constraints.add_element(
variable,
variable,
);
self.liveness_constraints.add_element(variable, variable);
}
}
......@@ -335,12 +329,7 @@ pub(super) fn add_live_point(&mut self, v: RegionVid, point: Location) -> bool {
}
/// Indicates that the region variable `sup` must outlive `sub` is live at the point `point`.
pub(super) fn add_outlives(
&mut self,
locations: Locations,
sup: RegionVid,
sub: RegionVid,
) {
pub(super) fn add_outlives(&mut self, locations: Locations, sup: RegionVid, sub: RegionVid) {
assert!(self.inferred_values.is_none(), "values already inferred");
self.constraints.push(OutlivesConstraint {
locations,
......@@ -445,11 +434,14 @@ fn compute_region_values(&self, _mir: &Mir<'tcx>) -> RegionValues {
debug!("propagate_constraints: sub={:?}", constraint.sub);
debug!("propagate_constraints: sup={:?}", constraint.sup);
self.constraints.each_affected_by_dirty(dependency_map[constraint.sup], |dep_idx| {
if clean_bit_vec.remove(dep_idx.index()) {
dirty_list.push(dep_idx);
}
});
self.constraints.each_affected_by_dirty(
dependency_map[constraint.sup],
|dep_idx| {
if clean_bit_vec.remove(dep_idx.index()) {
dirty_list.push(dep_idx);
}
},
);
}
debug!("\n");
......@@ -487,8 +479,12 @@ fn check_type_tests<'gcx>(
}
if let Some(propagated_outlives_requirements) = &mut propagated_outlives_requirements {
if self.try_promote_type_test(infcx, mir, type_test,
propagated_outlives_requirements) {
if self.try_promote_type_test(
infcx,
mir,
type_test,
propagated_outlives_requirements,
) {
continue;
}
}
......@@ -744,12 +740,7 @@ fn universal_upper_bound(&self, r: RegionVid) -> RegionVid {
/// Test if `test` is true when applied to `lower_bound` at
/// `point`, and returns true or false.
fn eval_region_test(
&self,
mir: &Mir<'tcx>,
lower_bound: RegionVid,
test: &RegionTest,
) -> bool {
fn eval_region_test(&self, mir: &Mir<'tcx>, lower_bound: RegionVid, test: &RegionTest) -> bool {
debug!(
"eval_region_test(lower_bound={:?}, test={:?})",
lower_bound, test
......@@ -781,10 +772,7 @@ fn eval_outlives(
sup_region: RegionVid,
sub_region: RegionVid,
) -> bool {
debug!(
"eval_outlives({:?}: {:?})",
sup_region, sub_region
);
debug!("eval_outlives({:?}: {:?})", sup_region, sub_region);
let inferred_values = self
.inferred_values
......
......@@ -28,7 +28,8 @@ pub(super) struct RegionValueElements {
impl RegionValueElements {
pub(super) fn new(mir: &Mir<'_>, num_universal_regions: usize) -> Self {
let mut num_points = 0;
let statements_before_block = mir.basic_blocks()
let statements_before_block = mir
.basic_blocks()
.iter()
.map(|block_data| {
let v = num_points;
......@@ -96,7 +97,8 @@ pub(super) fn to_element(&self, i: RegionElementIndex) -> RegionElement {
// be (BB2, 20).
//
// Nit: we could do a binary search here but I'm too lazy.
let (block, &first_index) = self.statements_before_block
let (block, &first_index) = self
.statements_before_block
.iter_enumerated()
.filter(|(_, first_index)| **first_index <= point_index)
.last()
......@@ -203,11 +205,7 @@ pub(super) fn new(elements: &Rc<RegionValueElements>, num_region_variables: usiz
/// Adds the given element to the value for the given region. Returns true if
/// the element is newly added (i.e., was not already present).
pub(super) fn add_element<E: ToElementIndex>(
&mut self,
r: RegionVid,
elem: E,
) -> bool {
pub(super) fn add_element<E: ToElementIndex>(&mut self, r: RegionVid, elem: E) -> bool {
let i = self.elements.index(elem);
debug!("add(r={:?}, elem={:?})", r, elem);
self.matrix.add(r, i)
......
......@@ -168,9 +168,7 @@ fn push_type_live_constraint<T>(
);
cx.tcx().for_each_free_region(&value, |live_region| {
cx.constraints
.liveness_set
.push((live_region, location));
cx.constraints.liveness_set.push((live_region, location));
});
}
......
......@@ -311,7 +311,10 @@ fn sanitize_constant(&mut self, constant: &Constant<'tcx>, location: Location) {
debug!("sanitize_constant: expected_ty={:?}", expected_ty);
if let Err(terr) = self.cx.eq_types(expected_ty, constant.ty, location.boring()) {
if let Err(terr) = self
.cx
.eq_types(expected_ty, constant.ty, location.boring())
{
span_mirbug!(
self,
constant,
......@@ -770,12 +773,7 @@ fn push_region_constraints(
}
}
fn sub_types(
&mut self,
sub: Ty<'tcx>,
sup: Ty<'tcx>,
locations: Locations,
) -> Fallible<()> {
fn sub_types(&mut self, sub: Ty<'tcx>, sup: Ty<'tcx>, locations: Locations) -> Fallible<()> {
let param_env = self.param_env;
self.fully_perform_op(
locations,
......@@ -807,7 +805,11 @@ fn check_stmt(&mut self, mir: &Mir<'tcx>, stmt: &Statement<'tcx>, location: Loca
false
};
let locations = if is_temp { location.boring() } else { location.interesting() };
let locations = if is_temp {
location.boring()
} else {
location.interesting()
};
let place_ty = place.ty(mir, tcx).to_ty(tcx);
let rv_ty = rv.ty(mir, tcx);
......@@ -982,10 +984,9 @@ fn check_terminator(
// output) types in the signature must be live, since
// all the inputs that fed into it were live.
for &late_bound_region in map.values() {
self.constraints.liveness_set.push((
late_bound_region,
term_location,
));
self.constraints
.liveness_set
.push((late_bound_region, term_location));
}
self.check_call_inputs(mir, term, &sig, args, term_location);
......@@ -1505,10 +1506,7 @@ fn prove_aggregate_predicates(
);
// Hmm, are these constraints *really* boring?
self.push_region_constraints(
location.boring(),
&closure_constraints,
);
self.push_region_constraints(location.boring(), &closure_constraints);
}
tcx.predicates_of(*def_id).instantiate(tcx, substs.substs)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册