about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThe Miri Conjob Bot <miri@cron.bot>2023-09-22 05:40:22 +0000
committerThe Miri Conjob Bot <miri@cron.bot>2023-09-22 05:40:22 +0000
commite6a4a1b12e0d8df98d80c1f4f4c3b09b9b994257 (patch)
treec1fdcb83b59c65bcf49f5c749ee2e04a45186d40
parentbf31cdb08ae233a147437251b7ecc366284d1209 (diff)
downloadrust-e6a4a1b12e0d8df98d80c1f4f4c3b09b9b994257.tar.gz
rust-e6a4a1b12e0d8df98d80c1f4f4c3b09b9b994257.zip
fmt
-rw-r--r--src/tools/miri/src/helpers.rs4
-rw-r--r--src/tools/miri/src/operator.rs14
-rw-r--r--src/tools/miri/src/shims/x86/sse2.rs22
3 files changed, 15 insertions, 25 deletions
diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs
index 537c767065d..badd2629388 100644
--- a/src/tools/miri/src/helpers.rs
+++ b/src/tools/miri/src/helpers.rs
@@ -1033,7 +1033,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
                 ) {
                     // Floating point value is NaN (flagged with INVALID_OP) or outside the range
                     // of values of the integer type (flagged with OVERFLOW or UNDERFLOW).
-                    return None
+                    return None;
                 } else {
                     // Floating point value can be represented by the integer type after rounding.
                     // The INEXACT flag is ignored on purpose to allow rounding.
@@ -1051,7 +1051,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
                 ) {
                     // Floating point value is NaN (flagged with INVALID_OP) or outside the range
                     // of values of the integer type (flagged with OVERFLOW or UNDERFLOW).
-                    return None
+                    return None;
                 } else {
                     // Floating point value can be represented by the integer type after rounding.
                     // The INEXACT flag is ignored on purpose to allow rounding.
diff --git a/src/tools/miri/src/operator.rs b/src/tools/miri/src/operator.rs
index 27fe7374ea5..1faf8f9fc12 100644
--- a/src/tools/miri/src/operator.rs
+++ b/src/tools/miri/src/operator.rs
@@ -65,12 +65,16 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriInterpCx<'mir, 'tcx> {
                     right.to_scalar().to_target_usize(self)?,
                     self.machine.layouts.usize,
                 );
-                let (result, overflowing) =
-                    self.overflowing_binary_op(bin_op, &left, &right)?;
+                let (result, overflowing) = self.overflowing_binary_op(bin_op, &left, &right)?;
                 // Construct a new pointer with the provenance of `ptr` (the LHS).
-                let result_ptr =
-                    Pointer::new(ptr.provenance, Size::from_bytes(result.to_scalar().to_target_usize(self)?));
-                (ImmTy::from_scalar(Scalar::from_maybe_pointer(result_ptr, self), left.layout), overflowing)
+                let result_ptr = Pointer::new(
+                    ptr.provenance,
+                    Size::from_bytes(result.to_scalar().to_target_usize(self)?),
+                );
+                (
+                    ImmTy::from_scalar(Scalar::from_maybe_pointer(result_ptr, self), left.layout),
+                    overflowing,
+                )
             }
 
             _ => span_bug!(self.cur_span(), "Invalid operator on pointers: {:?}", bin_op),
diff --git a/src/tools/miri/src/shims/x86/sse2.rs b/src/tools/miri/src/shims/x86/sse2.rs
index 6144e07130f..855ebbe7072 100644
--- a/src/tools/miri/src/shims/x86/sse2.rs
+++ b/src/tools/miri/src/shims/x86/sse2.rs
@@ -61,11 +61,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
                     let right = this.int_to_int_or_float(&right, twice_wide)?;
 
                     // Calculate left + right + 1
-                    let added = this.wrapping_binary_op(
-                        mir::BinOp::Add,
-                        &left,
-                        &right,
-                    )?;
+                    let added = this.wrapping_binary_op(mir::BinOp::Add, &left, &right)?;
                     let added = this.wrapping_binary_op(
                         mir::BinOp::Add,
                         &added,
@@ -80,10 +76,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
                     )?;
 
                     // Narrow back to the original type
-                    let res = this.int_to_int_or_float(
-                        &divided,
-                        dest.layout,
-                    )?;
+                    let res = this.int_to_int_or_float(&divided, dest.layout)?;
                     this.write_immediate(*res, &dest)?;
                 }
             }
@@ -110,11 +103,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
                     let right = this.int_to_int_or_float(&right, twice_wide)?;
 
                     // Multiply
-                    let multiplied = this.wrapping_binary_op(
-                        mir::BinOp::Mul,
-                        &left,
-                        &right,
-                    )?;
+                    let multiplied = this.wrapping_binary_op(mir::BinOp::Mul, &left, &right)?;
                     // Keep the high half
                     let high = this.wrapping_binary_op(
                         mir::BinOp::Shr,
@@ -123,10 +112,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
                     )?;
 
                     // Narrow back to the original type
-                    let res = this.int_to_int_or_float(
-                        &high,
-                        dest.layout,
-                    )?;
+                    let res = this.int_to_int_or_float(&high, dest.layout)?;
                     this.write_immediate(*res, &dest)?;
                 }
             }