This commit is contained in:
Ralf Jung 2023-06-02 10:09:32 +02:00
parent c5aebfb934
commit be4e05a190
2 changed files with 13 additions and 10 deletions

View File

@ -97,8 +97,12 @@ fn diagnostic_message(&self) -> DiagnosticMessage {
}
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);

View File

@ -162,9 +162,9 @@ fn eval_path_scalar(&self, path: &[&str]) -> Scalar<Provenance> {
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:?}"))
}