Skip to content

Commit

Permalink
Run x.py fmt to fix tidy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleywiser committed Feb 5, 2021
1 parent 7c7f10b commit dce5e9e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_mir_build/src/build/expr/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let fields: Vec<_> = if let Some(FruInfo { base, field_types }) = base {
let place_builder = unpack!(block = this.as_place_builder(block, base));


// MIR does not natively support FRU, so for each
// base-supplied field, generate an operand that
// reads it from the base.
Expand Down
20 changes: 6 additions & 14 deletions compiler/rustc_mir_build/src/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,12 +1422,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
match test.kind {
TestKind::SwitchInt { switch_ty, ref mut options } => {
for candidate in candidates.iter() {
if !self.add_cases_to_switch(
&match_place,
candidate,
switch_ty,
options,
) {
if !self.add_cases_to_switch(&match_place, candidate, switch_ty, options) {
break;
}
}
Expand Down Expand Up @@ -1842,14 +1837,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// ```
//
// and that is clearly not correct.
let by_value_bindings =
parent_bindings
.iter()
.flat_map(|(bindings, _)| bindings)
.chain(&candidate.bindings)
.filter(|binding| {
matches!(binding.binding_mode, BindingMode::ByValue )
});
let by_value_bindings = parent_bindings
.iter()
.flat_map(|(bindings, _)| bindings)
.chain(&candidate.bindings)
.filter(|binding| matches!(binding.binding_mode, BindingMode::ByValue));
// Read all of the by reference bindings to ensure that the
// place they refer to can't be modified by the guard.
for binding in by_value_bindings.clone() {
Expand Down
14 changes: 9 additions & 5 deletions compiler/rustc_mir_build/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
kind: hir::TraitItemKind::Const(ty, Some(body_id)),
..
}) => (*body_id, ty.span, None),
Node::AnonConst(hir::AnonConst { body, hir_id, .. }) => (*body, tcx.hir().span(*hir_id), None),
Node::AnonConst(hir::AnonConst { body, hir_id, .. }) => {
(*body, tcx.hir().span(*hir_id), None)
}

_ => span_bug!(tcx.hir().span(id), "can't build MIR for {:?}", def.did),
};
Expand Down Expand Up @@ -184,7 +186,7 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
return_ty,
return_ty_span,
body,
span_with_body
span_with_body,
);
mir.yield_ty = yield_ty;
mir
Expand Down Expand Up @@ -582,7 +584,7 @@ fn construct_fn<'a, 'tcx, A>(
return_ty: Ty<'tcx>,
return_ty_span: Span,
body: &'tcx hir::Body<'tcx>,
span_with_body: Span
span_with_body: Span,
) -> Body<'tcx>
where
A: Iterator<Item = ArgInfo<'tcx>>,
Expand Down Expand Up @@ -658,7 +660,8 @@ fn construct_const<'a, 'tcx>(
let owner_id = tcx.hir().body_owner(body_id);
let def_id = tcx.hir().local_def_id(owner_id);
let span = tcx.hir().span(owner_id);
let mut builder = Builder::new(hir, def_id.to_def_id(), span, 0, Safety::Safe, const_ty, const_ty_span, None);
let mut builder =
Builder::new(hir, def_id.to_def_id(), span, 0, Safety::Safe, const_ty, const_ty_span, None);

let mut block = START_BLOCK;
let ast_expr = &tcx.hir().body(body_id).value;
Expand Down Expand Up @@ -698,7 +701,8 @@ fn construct_error<'a, 'tcx>(hir: Cx<'a, 'tcx>, body_id: hir::BodyId) -> Body<'t
hir::BodyOwnerKind::Const => 0,
hir::BodyOwnerKind::Static(_) => 0,
};
let mut builder = Builder::new(hir, def_id.to_def_id(), span, num_params, Safety::Safe, ty, span, None);
let mut builder =
Builder::new(hir, def_id.to_def_id(), span, num_params, Safety::Safe, ty, span, None);
let source_info = builder.source_info(span);
// Some MIR passes will expect the number of parameters to match the
// function declaration.
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_mir_build/src/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let breakable_scope = self.scopes.breakable_scopes.pop().unwrap();
assert!(breakable_scope.region_scope == region_scope);
let break_block = self.build_exit_tree(breakable_scope.break_drops, None);
if let Some(drops) = breakable_scope.continue_drops { self.build_exit_tree(drops, loop_block); }
if let Some(drops) = breakable_scope.continue_drops {
self.build_exit_tree(drops, loop_block);
}
match (normal_exit_block, break_block) {
(Some(block), None) | (None, Some(block)) => block,
(None, None) => self.cfg.start_new_block().unit(),
Expand Down Expand Up @@ -1364,7 +1366,7 @@ impl<'tcx> DropTreeBuilder<'tcx> for Unwind {
| TerminatorKind::Yield { .. }
| TerminatorKind::GeneratorDrop
| TerminatorKind::FalseEdge { .. }
| TerminatorKind::InlineAsm {.. } => {
| TerminatorKind::InlineAsm { .. } => {
span_bug!(term.source_info.span, "cannot unwind from {:?}", term.kind)
}
}
Expand Down

0 comments on commit dce5e9e

Please sign in to comment.