about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-06-02 10:09:32 +0200
committerRalf Jung <post@ralfj.de>2023-06-02 10:09:32 +0200
commitbe4e05a1906d975ac0e09ca1a5ea2daf6a0018a0 (patch)
treea1649a1fd2e4663b8c5d239354674a387a855ae5 /src
parentc5aebfb9348277639b0877eb83995dfd1bd2ff23 (diff)
downloadrust-be4e05a1906d975ac0e09ca1a5ea2daf6a0018a0.tar.gz
rust-be4e05a1906d975ac0e09ca1a5ea2daf6a0018a0.zip
fmt
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/src/diagnostics.rs17
-rw-r--r--src/tools/miri/src/helpers.rs6
2 files changed, 13 insertions, 10 deletions
diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs
index 8c788c915fe..2a06bd871ef 100644
--- a/src/tools/miri/src/diagnostics.rs
+++ b/src/tools/miri/src/diagnostics.rs
@@ -97,8 +97,12 @@ impl MachineStopType for TerminationInfo {
     }
     fn add_args(
         self: Box<Self>,
-        _: &mut dyn FnMut(std::borrow::Cow<'static, str>, rustc_errors::DiagnosticArgValue<'static>),
-    ) {}
+        _: &mut dyn FnMut(
+            std::borrow::Cow<'static, str>,
+            rustc_errors::DiagnosticArgValue<'static>,
+        ),
+    ) {
+    }
 }
 
 /// Miri specific diagnostics
@@ -324,10 +328,9 @@ pub fn report_error<'tcx, 'mir>(
     // We want to dump the allocation if this is `InvalidUninitBytes`. Since `add_args` consumes
     // the `InterpError`, we extract the variables it before that.
     let extra = match e {
-        UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) => {
-            Some((alloc_id, access))
-        }
-        _ => None
+        UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) =>
+            Some((alloc_id, access)),
+        _ => None,
     };
 
     // FIXME(fee1-dead), HACK: we want to use the error as title therefore we can just extract the
@@ -477,7 +480,7 @@ pub fn report_msg<'tcx>(
     }
 
     let (mut err, handler) = err.into_diagnostic().unwrap();
-    
+
     // Add backtrace
     for (idx, frame_info) in stacktrace.iter().enumerate() {
         let is_local = machine.is_local(frame_info);
diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs
index f1190265239..befdddfa8c9 100644
--- a/src/tools/miri/src/helpers.rs
+++ b/src/tools/miri/src/helpers.rs
@@ -162,9 +162,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
         let instance = this.resolve_path(path, Namespace::ValueNS);
         let cid = GlobalId { instance, promoted: None };
         // We don't give a span -- this isn't actually used directly by the program anyway.
-        let const_val = this
-            .eval_global(cid, None)
-            .unwrap_or_else(|err| panic!("failed to evaluate required Rust item: {path:?}\n{err:?}"));
+        let const_val = this.eval_global(cid, None).unwrap_or_else(|err| {
+            panic!("failed to evaluate required Rust item: {path:?}\n{err:?}")
+        });
         this.read_scalar(&const_val.into())
             .unwrap_or_else(|err| panic!("failed to read required Rust item: {path:?}\n{err:?}"))
     }