forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverflow_panic.rs
More file actions
63 lines (53 loc) · 1.27 KB
/
Copy pathoverflow_panic.rs
File metadata and controls
63 lines (53 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Functions for panicking on overflow.
//!
//! In particular, these are used by the `strict_` methods on integers.
#[cold]
#[track_caller]
pub(in crate::num) const fn add() -> ! {
panic!("attempt to add with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn sub() -> ! {
panic!("attempt to subtract with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn mul() -> ! {
panic!("attempt to multiply with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn div() -> ! {
panic!("attempt to divide with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn rem() -> ! {
panic!("attempt to calculate the remainder with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn neg() -> ! {
panic!("attempt to negate with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn shr() -> ! {
panic!("attempt to shift right with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn shl() -> ! {
panic!("attempt to shift left with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn pow() -> ! {
panic!("attempt to exponentiate with overflow")
}
#[cold]
#[track_caller]
pub(in crate::num) const fn cast_integer() -> ! {
panic!("attempt to cast integer with overflow")
}