From be4e05a1906d975ac0e09ca1a5ea2daf6a0018a0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 2 Jun 2023 10:09:32 +0200 Subject: [PATCH] fmt --- src/tools/miri/src/diagnostics.rs | 17 ++++++++++------- src/tools/miri/src/helpers.rs | 6 +++--- 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 @@ fn diagnostic_message(&self) -> DiagnosticMessage { } fn add_args( self: Box, - _: &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 @@ fn eval_path_scalar(&self, path: &[&str]) -> Scalar { 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:?}")) }