rust/library/core
Dylan DPC 83faac9da4
Rollup merge of #82683 - jturner314:int-div-rem-doc-panic, r=nikomatsakis
Document panicking cases for integer division and remainder

This PR documents the cases when integer division and remainder operations panic. These operations panic in two cases: division by zero and overflow.

It's surprising that these operations always panic on overflow, unlike most other arithmetic operations, which panic on overflow only when `debug_assertions` is enabled. The panic on overflow for the remainder is also surprising because a return value of `0` would be reasonable in this case. ("Overflow" occurs only for `MIN % -1`.) Since the panics on overflow are somewhat surprising, they should be documented.

I guess it's worth asking: is panic on overflow (even when `debug_assertions` is disabled) the intended behavior? If not, what's the best way forward?
2021-03-22 15:21:24 +01:00
..
benches Auto merge of #81358 - mcastorina:to-upper-lower-speed, r=joshtriplett 2021-03-17 11:17:18 +00:00
src Rollup merge of #82683 - jturner314:int-div-rem-doc-panic, r=nikomatsakis 2021-03-22 15:21:24 +01:00
tests Rollup merge of #79208 - LeSeulArtichaut:stable-unsafe_op_in_unsafe_fn, r=nikomatsakis 2021-03-10 08:01:25 +09:00
Cargo.toml Add license metadata for std dependencies 2021-02-21 13:36:18 -05:00