constify exact_div
intrinsic
This commit is contained in:
parent
5e6de2369c
commit
f13c4f4d6a
4 changed files with 7 additions and 5 deletions
|
@ -243,6 +243,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
let discr_val = self.read_discriminant(&place.into())?.0;
|
let discr_val = self.read_discriminant(&place.into())?.0;
|
||||||
self.write_scalar(discr_val, dest)?;
|
self.write_scalar(discr_val, dest)?;
|
||||||
}
|
}
|
||||||
|
sym::exact_div => {
|
||||||
|
let l = self.read_immediate(&args[0])?;
|
||||||
|
let r = self.read_immediate(&args[1])?;
|
||||||
|
self.exact_div(&l, &r, dest)?;
|
||||||
|
}
|
||||||
sym::unchecked_shl
|
sym::unchecked_shl
|
||||||
| sym::unchecked_shr
|
| sym::unchecked_shr
|
||||||
| sym::unchecked_add
|
| sym::unchecked_add
|
||||||
|
|
|
@ -1851,6 +1851,7 @@ extern "rust-intrinsic" {
|
||||||
/// `x % y != 0` or `y == 0` or `x == T::MIN && y == -1`
|
/// `x % y != 0` or `y == 0` or `x == T::MIN && y == -1`
|
||||||
///
|
///
|
||||||
/// This intrinsic does not have a stable counterpart.
|
/// This intrinsic does not have a stable counterpart.
|
||||||
|
#[rustc_const_unstable(feature = "const_exact_div", issue = "none")]
|
||||||
pub fn exact_div<T: Copy>(x: T, y: T) -> T;
|
pub fn exact_div<T: Copy>(x: T, y: T) -> T;
|
||||||
|
|
||||||
/// Performs an unchecked division, resulting in undefined behavior
|
/// Performs an unchecked division, resulting in undefined behavior
|
||||||
|
|
|
@ -109,6 +109,7 @@
|
||||||
#![feature(const_cmp)]
|
#![feature(const_cmp)]
|
||||||
#![feature(const_discriminant)]
|
#![feature(const_discriminant)]
|
||||||
#![feature(const_eval_select)]
|
#![feature(const_eval_select)]
|
||||||
|
#![feature(const_exact_div)]
|
||||||
#![feature(const_float_bits_conv)]
|
#![feature(const_float_bits_conv)]
|
||||||
#![feature(const_float_classify)]
|
#![feature(const_float_classify)]
|
||||||
#![feature(const_fmt_arguments_new)]
|
#![feature(const_fmt_arguments_new)]
|
||||||
|
|
|
@ -368,11 +368,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
"exact_div" => {
|
|
||||||
let [num, denom] = check_arg_count(args)?;
|
|
||||||
this.exact_div(&this.read_immediate(num)?, &this.read_immediate(denom)?, dest)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
"breakpoint" => {
|
"breakpoint" => {
|
||||||
let [] = check_arg_count(args)?;
|
let [] = check_arg_count(args)?;
|
||||||
// normally this would raise a SIGTRAP, which aborts if no debugger is connected
|
// normally this would raise a SIGTRAP, which aborts if no debugger is connected
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue