fix for latest rustc

This commit is contained in:
Ralf Jung 2019-08-05 10:45:48 +02:00
parent 93e110f370
commit d26917a9d6
6 changed files with 15 additions and 15 deletions

View file

@ -1 +1 @@
a45743345659c775b01484574af2818c46a2cb03
11a51488f03405ea539a9fe84973ee972eaa7b96

View file

@ -655,9 +655,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// This is `libc::pthread_key_t`.
let key_type = args[0].layout.ty
.builtin_deref(true)
.ok_or_else(|| err_ub!(Ub(format!(
.ok_or_else(|| err_ub_format!(
"wrong signature used for `pthread_key_create`: first argument must be a raw pointer."
))))?
))?
.ty;
let key_layout = this.layout_of(key_type)?;

View file

@ -44,7 +44,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
"assume" => {
let cond = this.read_scalar(args[0])?.to_bool()?;
if !cond {
throw_unsup!(AssumptionNotHeld);
throw_ub_format!("`assume` intrinsic called with `false`");
}
}
@ -316,9 +316,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// Check if `b` is -1, which is the "min_value / -1" case.
let minus1 = Scalar::from_int(-1, dest.layout.size);
return Err(if b.to_scalar().unwrap() == minus1 {
err_ub!(Ub(format!("exact_div: result of dividing MIN by -1 cannot be represented")))
err_ub_format!("exact_div: result of dividing MIN by -1 cannot be represented")
} else {
err_ub!(Ub(format!("exact_div: {:?} cannot be divided by {:?} without remainder", *a, *b)))
err_ub_format!("exact_div: {:?} cannot be divided by {:?} without remainder", *a, *b)
}.into());
}
this.binop_ignore_overflow(mir::BinOp::Div, a, b, dest)?;

View file

@ -158,7 +158,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
StackPopCleanup::None { cleanup: true },
)?;
let arg_local = this.frame().body.args_iter().next().ok_or_else(
|| err_ub!(Ub(format!("TLS dtor does not take enough arguments."))),
|| err_ub_format!("TLS dtor does not take enough arguments."),
)?;
let dest = this.local_place(arg_local)?;
this.write_scalar(ptr, dest)?;

View file

@ -273,14 +273,14 @@ impl<'tcx> Stack {
if let Some(call) = item.protector {
if global.is_active(call) {
if let Some(tag) = tag {
throw_ub_format!(
throw_ub!(UbExperimental(format!(
"not granting access to tag {:?} because incompatible item is protected: {:?}",
tag, item
);
)));
} else {
throw_ub_format!(
throw_ub!(UbExperimental(format!(
"deallocating while item is protected: {:?}", item
);
)));
}
}
}
@ -299,7 +299,7 @@ impl<'tcx> Stack {
// Step 1: Find granting item.
let granting_idx = self.find_granting(access, tag)
.ok_or_else(|| err_ub!(Ub(format!(
.ok_or_else(|| err_ub!(UbExperimental(format!(
"no item granting {} to tag {:?} found in borrow stack",
access, tag,
))))?;
@ -346,7 +346,7 @@ impl<'tcx> Stack {
) -> InterpResult<'tcx> {
// Step 1: Find granting item.
self.find_granting(AccessKind::Write, tag)
.ok_or_else(|| err_ub!(Ub(format!(
.ok_or_else(|| err_ub!(UbExperimental(format!(
"no item granting write access for deallocation to tag {:?} found in borrow stack",
tag,
))))?;
@ -378,7 +378,7 @@ impl<'tcx> Stack {
// Now we figure out which item grants our parent (`derived_from`) this kind of access.
// We use that to determine where to put the new item.
let granting_idx = self.find_granting(access, derived_from)
.ok_or_else(|| err_ub!(Ub(format!(
.ok_or_else(|| err_ub!(UbExperimental(format!(
"trying to reborrow for {:?}, but parent tag {:?} does not have an appropriate item in the borrow stack", new.perm, derived_from,
))))?;

View file

@ -5,6 +5,6 @@ fn main() {
unsafe {
std::intrinsics::assume(x < 10);
std::intrinsics::assume(x > 1);
std::intrinsics::assume(x > 42); //~ `assume` argument was false
std::intrinsics::assume(x > 42); //~ `assume` intrinsic called with `false`
}
}