core/num/
overflow_panic.rs

1//! Functions for panicking on overflow.
2//!
3//! In particular, these are used by the `strict_` methods on integers.
4
5#[cold]
6#[track_caller]
7pub(super) const fn add() -> ! {
8    panic!("attempt to add with overflow")
9}
10
11#[cold]
12#[track_caller]
13pub(super) const fn sub() -> ! {
14    panic!("attempt to subtract with overflow")
15}
16
17#[cold]
18#[track_caller]
19pub(super) const fn mul() -> ! {
20    panic!("attempt to multiply with overflow")
21}
22
23#[cold]
24#[track_caller]
25pub(super) const fn div() -> ! {
26    panic!("attempt to divide with overflow")
27}
28
29#[cold]
30#[track_caller]
31pub(super) const fn rem() -> ! {
32    panic!("attempt to calculate the remainder with overflow")
33}
34
35#[cold]
36#[track_caller]
37pub(super) const fn neg() -> ! {
38    panic!("attempt to negate with overflow")
39}
40
41#[cold]
42#[track_caller]
43pub(super) const fn shr() -> ! {
44    panic!("attempt to shift right with overflow")
45}
46
47#[cold]
48#[track_caller]
49pub(super) const fn shl() -> ! {
50    panic!("attempt to shift left with overflow")
51}