Closed
Description
These used to require if
to work, but are forwarded to llvm intrinsics nowadays (#58003). We can now implement them as const eval intrinsics, too.
Impl instructions:
- add to
- remove
unsafe
for calls to the intrinsic - add to
- make functions calling the intrinsic
const fn
- Implement in
rust/src/librustc_mir/interpret/intrinsics.rs
Line 102 in 79d8a0f
read_immediate
calls, a call tobinary_op_imm
with arguments similar to the other add/sub intrinsics, in case the overflow bool in the return value is false, write the actual value to the destination like in . In case the overflow bool is true, compute the min or max value of the type like inrust/src/librustc_mir/interpret/operator.rs
Line 217 in 79d8a0f
dest
. - Write some tests that use the saturating methods in constants