1
Fork 0

Run x.py fmt to fix tidy issues

This commit is contained in:
Wesley Wiser 2021-02-05 06:35:32 -05:00
parent 7c7f10ba38
commit dce5e9e1bf
4 changed files with 19 additions and 22 deletions

View file

@ -275,7 +275,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let fields: Vec<_> = if let Some(FruInfo { base, field_types }) = base { let fields: Vec<_> = if let Some(FruInfo { base, field_types }) = base {
let place_builder = unpack!(block = this.as_place_builder(block, base)); let place_builder = unpack!(block = this.as_place_builder(block, base));
// MIR does not natively support FRU, so for each // MIR does not natively support FRU, so for each
// base-supplied field, generate an operand that // base-supplied field, generate an operand that
// reads it from the base. // reads it from the base.

View file

@ -1422,12 +1422,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
match test.kind { match test.kind {
TestKind::SwitchInt { switch_ty, ref mut options } => { TestKind::SwitchInt { switch_ty, ref mut options } => {
for candidate in candidates.iter() { for candidate in candidates.iter() {
if !self.add_cases_to_switch( if !self.add_cases_to_switch(&match_place, candidate, switch_ty, options) {
&match_place,
candidate,
switch_ty,
options,
) {
break; break;
} }
} }
@ -1842,14 +1837,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// ``` // ```
// //
// and that is clearly not correct. // and that is clearly not correct.
let by_value_bindings = let by_value_bindings = parent_bindings
parent_bindings .iter()
.iter() .flat_map(|(bindings, _)| bindings)
.flat_map(|(bindings, _)| bindings) .chain(&candidate.bindings)
.chain(&candidate.bindings) .filter(|binding| matches!(binding.binding_mode, BindingMode::ByValue));
.filter(|binding| {
matches!(binding.binding_mode, BindingMode::ByValue )
});
// Read all of the by reference bindings to ensure that the // Read all of the by reference bindings to ensure that the
// place they refer to can't be modified by the guard. // place they refer to can't be modified by the guard.
for binding in by_value_bindings.clone() { for binding in by_value_bindings.clone() {

View file

@ -76,7 +76,9 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
kind: hir::TraitItemKind::Const(ty, Some(body_id)), kind: hir::TraitItemKind::Const(ty, Some(body_id)),
.. ..
}) => (*body_id, ty.span, None), }) => (*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), _ => span_bug!(tcx.hir().span(id), "can't build MIR for {:?}", def.did),
}; };
@ -184,7 +186,7 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
return_ty, return_ty,
return_ty_span, return_ty_span,
body, body,
span_with_body span_with_body,
); );
mir.yield_ty = yield_ty; mir.yield_ty = yield_ty;
mir mir
@ -582,7 +584,7 @@ fn construct_fn<'a, 'tcx, A>(
return_ty: Ty<'tcx>, return_ty: Ty<'tcx>,
return_ty_span: Span, return_ty_span: Span,
body: &'tcx hir::Body<'tcx>, body: &'tcx hir::Body<'tcx>,
span_with_body: Span span_with_body: Span,
) -> Body<'tcx> ) -> Body<'tcx>
where where
A: Iterator<Item = ArgInfo<'tcx>>, A: Iterator<Item = ArgInfo<'tcx>>,
@ -658,7 +660,8 @@ fn construct_const<'a, 'tcx>(
let owner_id = tcx.hir().body_owner(body_id); let owner_id = tcx.hir().body_owner(body_id);
let def_id = tcx.hir().local_def_id(owner_id); let def_id = tcx.hir().local_def_id(owner_id);
let span = tcx.hir().span(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 mut block = START_BLOCK;
let ast_expr = &tcx.hir().body(body_id).value; let ast_expr = &tcx.hir().body(body_id).value;
@ -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::Const => 0,
hir::BodyOwnerKind::Static(_) => 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); let source_info = builder.source_info(span);
// Some MIR passes will expect the number of parameters to match the // Some MIR passes will expect the number of parameters to match the
// function declaration. // function declaration.

View file

@ -458,7 +458,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let breakable_scope = self.scopes.breakable_scopes.pop().unwrap(); let breakable_scope = self.scopes.breakable_scopes.pop().unwrap();
assert!(breakable_scope.region_scope == region_scope); assert!(breakable_scope.region_scope == region_scope);
let break_block = self.build_exit_tree(breakable_scope.break_drops, None); 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) { match (normal_exit_block, break_block) {
(Some(block), None) | (None, Some(block)) => block, (Some(block), None) | (None, Some(block)) => block,
(None, None) => self.cfg.start_new_block().unit(), (None, None) => self.cfg.start_new_block().unit(),
@ -1364,7 +1366,7 @@ impl<'tcx> DropTreeBuilder<'tcx> for Unwind {
| TerminatorKind::Yield { .. } | TerminatorKind::Yield { .. }
| TerminatorKind::GeneratorDrop | TerminatorKind::GeneratorDrop
| TerminatorKind::FalseEdge { .. } | TerminatorKind::FalseEdge { .. }
| TerminatorKind::InlineAsm {.. } => { | TerminatorKind::InlineAsm { .. } => {
span_bug!(term.source_info.span, "cannot unwind from {:?}", term.kind) span_bug!(term.source_info.span, "cannot unwind from {:?}", term.kind)
} }
} }