Location
The documentation of rem_euclid and div_euclid for any signed integer type, e.g.: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.rem_euclid
Summary
In the "Panics" section it says "This function will panic if rhs is 0 or if self is -1 and rhs is Self::MIN.", but I believe this is the wrong way around: the panic happens on MIN % -1, not on (-1) % MIN, as (correctly) explained in wrapping_rem_euclid and all other related functions.
Also, is there any situation where someone would want rem_euclid over wrapping_rem_euclid? Mathematically, MIN % -1 should really just be 0, that it panics is more of an implementation artifact (the corresponding division MIN / -1 overflows). Maybe it would be a good idea to add something like "If this is a problem, use wrapping_rem_euclid instead." to the documentation of rem_euclid? Though in most applications rhs will probably be positive anyway.
Location
The documentation of
rem_euclidanddiv_euclidfor any signed integer type, e.g.: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.rem_euclidSummary
In the "Panics" section it says "This function will panic if
rhsis 0 or ifselfis -1 andrhsisSelf::MIN.", but I believe this is the wrong way around: the panic happens onMIN % -1, not on(-1) % MIN, as (correctly) explained inwrapping_rem_euclidand all other related functions.Also, is there any situation where someone would want
rem_euclidoverwrapping_rem_euclid? Mathematically,MIN % -1should really just be 0, that it panics is more of an implementation artifact (the corresponding divisionMIN / -1overflows). Maybe it would be a good idea to add something like "If this is a problem, usewrapping_rem_euclidinstead." to the documentation ofrem_euclid? Though in most applicationsrhswill probably be positive anyway.