diff --git a/rust-version b/rust-version index 94c6f5e4b8c9..0680001291b7 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -a45743345659c775b01484574af2818c46a2cb03 +11a51488f03405ea539a9fe84973ee972eaa7b96 diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 538109eceae7..37e5fe42c3de 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -655,9 +655,9 @@ fn emulate_foreign_item( // 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)?; diff --git a/src/shims/intrinsics.rs b/src/shims/intrinsics.rs index 52a17a92c2ed..c96869c80cee 100644 --- a/src/shims/intrinsics.rs +++ b/src/shims/intrinsics.rs @@ -44,7 +44,7 @@ fn call_intrinsic( "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 @@ fn call_intrinsic( // 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)?; diff --git a/src/shims/tls.rs b/src/shims/tls.rs index 05b8dc15da66..d2190bd969e3 100644 --- a/src/shims/tls.rs +++ b/src/shims/tls.rs @@ -158,7 +158,7 @@ fn run_tls_dtors(&mut self) -> InterpResult<'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)?; diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index 0fbc3e1ac281..01ed6ec225d2 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -273,14 +273,14 @@ fn check_protector(item: &Item, tag: Option, global: &GlobalState) -> Inter 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 @@ fn access( // 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 @@ fn dealloc( ) -> 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 @@ fn grant( // 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, ))))?; diff --git a/tests/compile-fail/assume.rs b/tests/compile-fail/assume.rs index 3026124e1f9a..7b18cab79805 100644 --- a/tests/compile-fail/assume.rs +++ b/tests/compile-fail/assume.rs @@ -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` } }