Open
Description
Feature gate: #![feature(unchecked_div_rem)]
This is a tracking issue for unchecked versions of /
and %
on integers. This is similar to existing methods like unchecked_mul
.
Public API
// in core
impl {i8, u8, i16, u16, i32, u32, i64, u64, i128, u128} {
// Same preconditions as the versions in intrinsics
/// Performs an unchecked division, resulting in undefined behavior where y == 0 or x == T::MIN && y == -1.
pub fn unchecked_div(self, rhs: Self) -> Self;
/// Returns the remainder of an unchecked division, resulting in undefined behavior when y == 0 or x == T::MIN && y == -1.
pub fn unchecked_rem(self, rhs: Self) -> Self;
}
Steps / History
- ACP: ACP: add
{integer}::unchecked_div
and{integer}::unchecked_rem
libs-team#526 - Implementation: #...
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Signed and unsigned have different preconditions; should the names be different as a stumbling stone when changing between the two? Tracking Issue for
unchecked_div_rem
#136716 (comment)
Footnotes
Metadata
Metadata
Assignees
Labels
Category: An issue tracking the progress of sth. like the implementation of an RFCCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Help is requested to fix this issue.Relevant to the library API team, which will review and decide on the PR/issue.