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( fn add_args(
self: Box<Self>, 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 /// 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 // We want to dump the allocation if this is `InvalidUninitBytes`. Since `add_args` consumes
// the `InterpError`, we extract the variables it before that. // the `InterpError`, we extract the variables it before that.
let extra = match e { let extra = match e {
UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) => { UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) =>
Some((alloc_id, access)) Some((alloc_id, access)),
} _ => None,
_ => None
}; };
// FIXME(fee1-dead), HACK: we want to use the error as title therefore we can just extract the // FIXME(fee1-dead), HACK: we want to use the error as title therefore we can just extract the

View File

@ -162,9 +162,9 @@ fn eval_path_scalar(&self, path: &[&str]) -> Scalar<Provenance> {
let instance = this.resolve_path(path, Namespace::ValueNS); let instance = this.resolve_path(path, Namespace::ValueNS);
let cid = GlobalId { instance, promoted: None }; let cid = GlobalId { instance, promoted: None };
// We don't give a span -- this isn't actually used directly by the program anyway. // We don't give a span -- this isn't actually used directly by the program anyway.
let const_val = this let const_val = this.eval_global(cid, None).unwrap_or_else(|err| {
.eval_global(cid, None) panic!("failed to evaluate required Rust item: {path:?}\n{err:?}")
.unwrap_or_else(|err| panic!("failed to evaluate required Rust item: {path:?}\n{err:?}")); });
this.read_scalar(&const_val.into()) this.read_scalar(&const_val.into())
.unwrap_or_else(|err| panic!("failed to read required Rust item: {path:?}\n{err:?}")) .unwrap_or_else(|err| panic!("failed to read required Rust item: {path:?}\n{err:?}"))
} }