Skip to content

Commit f2da425

Browse files
committed
./x.py fmt
1 parent d06a2a3 commit f2da425

File tree

5 files changed

+34
-26
lines changed

5 files changed

+34
-26
lines changed

compiler/rustc_mir/src/interpret/eval_context.rs

+18-17
Original file line numberDiff line numberDiff line change
@@ -577,24 +577,25 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
577577
// the last field). Can't have foreign types here, how would we
578578
// adjust alignment and size for them?
579579
let field = layout.field(self, layout.fields.count() - 1)?;
580-
let (unsized_size, unsized_align) = match self.size_and_align_of(metadata, &field)? {
581-
Some(size_and_align) => size_and_align,
582-
None => {
583-
// A field with extern type. If this field is at offset 0, we behave
584-
// like the underlying extern type.
585-
// FIXME: Once we have made decisions for how to handle size and alignment
586-
// of `extern type`, this should be adapted. It is just a temporary hack
587-
// to get some code to work that probably ought to work.
588-
if sized_size == Size::ZERO {
589-
return Ok(None);
590-
} else {
591-
span_bug!(
592-
self.cur_span(),
593-
"Fields cannot be extern types, unless they are at offset 0"
594-
)
580+
let (unsized_size, unsized_align) =
581+
match self.size_and_align_of(metadata, &field)? {
582+
Some(size_and_align) => size_and_align,
583+
None => {
584+
// A field with extern type. If this field is at offset 0, we behave
585+
// like the underlying extern type.
586+
// FIXME: Once we have made decisions for how to handle size and alignment
587+
// of `extern type`, this should be adapted. It is just a temporary hack
588+
// to get some code to work that probably ought to work.
589+
if sized_size == Size::ZERO {
590+
return Ok(None);
591+
} else {
592+
span_bug!(
593+
self.cur_span(),
594+
"Fields cannot be extern types, unless they are at offset 0"
595+
)
596+
}
595597
}
596-
}
597-
};
598+
};
598599

599600
// FIXME (#26403, #27023): We should be adding padding
600601
// to `sized_size` (to accommodate the `unsized_align`

compiler/rustc_mir/src/interpret/intrinsics.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
226226
let l = self.read_immediate(&args[0])?;
227227
let r = self.read_immediate(&args[1])?;
228228
let is_add = intrinsic_name == sym::saturating_add;
229-
let (val, overflowed, _ty) =
230-
self.overflowing_binary_op(if is_add { BinOp::Add } else { BinOp::Sub }, &l, &r)?;
229+
let (val, overflowed, _ty) = self.overflowing_binary_op(
230+
if is_add { BinOp::Add } else { BinOp::Sub },
231+
&l,
232+
&r,
233+
)?;
231234
let val = if overflowed {
232235
let num_bits = l.layout.size.bits();
233236
if l.layout.abi.is_signed() {

compiler/rustc_mir/src/interpret/terminator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
8383
Some((dest, ret)) => {
8484
dest_place = self.eval_place(dest)?;
8585
Some((&dest_place, ret))
86-
},
86+
}
8787
None => None,
8888
};
8989
self.eval_fn_call(fn_val, abi, &args[..], ret, *cleanup)?;

compiler/rustc_mir/src/interpret/visitor.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ pub trait Value<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Copy {
1818
fn layout(&self) -> TyAndLayout<'tcx>;
1919

2020
/// Makes this into an `OpTy`.
21-
fn to_op(&self, ecx: &InterpCx<'mir, 'tcx, M>) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>>;
21+
fn to_op(&self, ecx: &InterpCx<'mir, 'tcx, M>)
22+
-> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>>;
2223

2324
/// Creates this from an `MPlaceTy`.
2425
fn from_mem_place(mplace: MPlaceTy<'tcx, M::PointerTag>) -> Self;
@@ -31,8 +32,11 @@ pub trait Value<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Copy {
3132
) -> InterpResult<'tcx, Self>;
3233

3334
/// Projects to the n-th field.
34-
fn project_field(&self, ecx: &InterpCx<'mir, 'tcx, M>, field: usize)
35-
-> InterpResult<'tcx, Self>;
35+
fn project_field(
36+
&self,
37+
ecx: &InterpCx<'mir, 'tcx, M>,
38+
field: usize,
39+
) -> InterpResult<'tcx, Self>;
3640
}
3741

3842
// Operands and memory-places are both values.

compiler/rustc_mir/src/transform/const_prop.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1198,9 +1198,9 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
11981198
// This can be `None` if the lhs wasn't const propagated and we just
11991199
// triggered the assert on the value of the rhs.
12001200
match self.eval_operand(op, source_info) {
1201-
Some(op) => {
1202-
DbgVal::Val(self.ecx.read_immediate(&op).unwrap().to_const_int())
1203-
}
1201+
Some(op) => DbgVal::Val(
1202+
self.ecx.read_immediate(&op).unwrap().to_const_int(),
1203+
),
12041204
None => DbgVal::Underscore,
12051205
}
12061206
};

0 commit comments

Comments
 (0)