Skip to content

Commit be4e05a

Browse files
committed
fmt
1 parent c5aebfb commit be4e05a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/tools/miri/src/diagnostics.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ impl MachineStopType for TerminationInfo {
9797
}
9898
fn add_args(
9999
self: Box<Self>,
100-
_: &mut dyn FnMut(std::borrow::Cow<'static, str>, rustc_errors::DiagnosticArgValue<'static>),
101-
) {}
100+
_: &mut dyn FnMut(
101+
std::borrow::Cow<'static, str>,
102+
rustc_errors::DiagnosticArgValue<'static>,
103+
),
104+
) {
105+
}
102106
}
103107

104108
/// Miri specific diagnostics
@@ -324,10 +328,9 @@ pub fn report_error<'tcx, 'mir>(
324328
// We want to dump the allocation if this is `InvalidUninitBytes`. Since `add_args` consumes
325329
// the `InterpError`, we extract the variables it before that.
326330
let extra = match e {
327-
UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) => {
328-
Some((alloc_id, access))
329-
}
330-
_ => None
331+
UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) =>
332+
Some((alloc_id, access)),
333+
_ => None,
331334
};
332335

333336
// 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>(
477480
}
478481

479482
let (mut err, handler) = err.into_diagnostic().unwrap();
480-
483+
481484
// Add backtrace
482485
for (idx, frame_info) in stacktrace.iter().enumerate() {
483486
let is_local = machine.is_local(frame_info);

src/tools/miri/src/helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
162162
let instance = this.resolve_path(path, Namespace::ValueNS);
163163
let cid = GlobalId { instance, promoted: None };
164164
// We don't give a span -- this isn't actually used directly by the program anyway.
165-
let const_val = this
166-
.eval_global(cid, None)
167-
.unwrap_or_else(|err| panic!("failed to evaluate required Rust item: {path:?}\n{err:?}"));
165+
let const_val = this.eval_global(cid, None).unwrap_or_else(|err| {
166+
panic!("failed to evaluate required Rust item: {path:?}\n{err:?}")
167+
});
168168
this.read_scalar(&const_val.into())
169169
.unwrap_or_else(|err| panic!("failed to read required Rust item: {path:?}\n{err:?}"))
170170
}

0 commit comments

Comments
 (0)