Skip to content

Commit 724fe8f

Browse files
committed
Adjust Attributes of Integer Division Methods
1 parent 75c68cf commit 724fe8f

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

library/core/src/num/int_macros.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1913,6 +1913,7 @@ macro_rules! int_impl {
19131913
#[must_use = "this returns the result of the operation, \
19141914
without modifying the original"]
19151915
#[inline]
1916+
#[track_caller]
19161917
pub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
19171918
if unlikely!(rhs == -1) {
19181919
(0, self == Self::MIN)
@@ -2172,7 +2173,7 @@ macro_rules! int_impl {
21722173
#[must_use = "this returns the result of the operation, \
21732174
without modifying the original"]
21742175
#[inline]
2175-
#[rustc_inherit_overflow_checks]
2176+
#[track_caller]
21762177
pub const fn div_euclid(self, rhs: Self) -> Self {
21772178
let q = self / rhs;
21782179
if self % rhs < 0 {
@@ -2211,7 +2212,7 @@ macro_rules! int_impl {
22112212
#[must_use = "this returns the result of the operation, \
22122213
without modifying the original"]
22132214
#[inline]
2214-
#[rustc_inherit_overflow_checks]
2215+
#[track_caller]
22152216
pub const fn rem_euclid(self, rhs: Self) -> Self {
22162217
let r = self % rhs;
22172218
if r < 0 {
@@ -2258,7 +2259,7 @@ macro_rules! int_impl {
22582259
#[must_use = "this returns the result of the operation, \
22592260
without modifying the original"]
22602261
#[inline]
2261-
#[rustc_inherit_overflow_checks]
2262+
#[track_caller]
22622263
pub const fn div_floor(self, rhs: Self) -> Self {
22632264
let d = self / rhs;
22642265
let r = self % rhs;
@@ -2298,7 +2299,7 @@ macro_rules! int_impl {
22982299
#[must_use = "this returns the result of the operation, \
22992300
without modifying the original"]
23002301
#[inline]
2301-
#[rustc_inherit_overflow_checks]
2302+
#[track_caller]
23022303
pub const fn div_ceil(self, rhs: Self) -> Self {
23032304
let d = self / rhs;
23042305
let r = self % rhs;

library/core/src/num/uint_macros.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,7 @@ macro_rules! uint_impl {
11411141
#[must_use = "this returns the result of the operation, \
11421142
without modifying the original"]
11431143
#[inline]
1144+
#[track_caller]
11441145
pub const fn saturating_div(self, rhs: Self) -> Self {
11451146
// on unsigned types, there is no overflow in integer division
11461147
self.wrapping_div(rhs)
@@ -1275,6 +1276,7 @@ macro_rules! uint_impl {
12751276
#[must_use = "this returns the result of the operation, \
12761277
without modifying the original"]
12771278
#[inline(always)]
1279+
#[track_caller]
12781280
pub const fn wrapping_div(self, rhs: Self) -> Self {
12791281
self / rhs
12801282
}
@@ -1304,6 +1306,7 @@ macro_rules! uint_impl {
13041306
#[must_use = "this returns the result of the operation, \
13051307
without modifying the original"]
13061308
#[inline(always)]
1309+
#[track_caller]
13071310
pub const fn wrapping_div_euclid(self, rhs: Self) -> Self {
13081311
self / rhs
13091312
}
@@ -1331,6 +1334,7 @@ macro_rules! uint_impl {
13311334
#[must_use = "this returns the result of the operation, \
13321335
without modifying the original"]
13331336
#[inline(always)]
1337+
#[track_caller]
13341338
pub const fn wrapping_rem(self, rhs: Self) -> Self {
13351339
self % rhs
13361340
}
@@ -1361,6 +1365,7 @@ macro_rules! uint_impl {
13611365
#[must_use = "this returns the result of the operation, \
13621366
without modifying the original"]
13631367
#[inline(always)]
1368+
#[track_caller]
13641369
pub const fn wrapping_rem_euclid(self, rhs: Self) -> Self {
13651370
self % rhs
13661371
}
@@ -1743,6 +1748,7 @@ macro_rules! uint_impl {
17431748
#[rustc_const_stable(feature = "const_overflowing_int_methods", since = "1.52.0")]
17441749
#[must_use = "this returns the result of the operation, \
17451750
without modifying the original"]
1751+
#[track_caller]
17461752
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool) {
17471753
(self / rhs, false)
17481754
}
@@ -1773,6 +1779,7 @@ macro_rules! uint_impl {
17731779
#[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.52.0")]
17741780
#[must_use = "this returns the result of the operation, \
17751781
without modifying the original"]
1782+
#[track_caller]
17761783
pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
17771784
(self / rhs, false)
17781785
}
@@ -1800,6 +1807,7 @@ macro_rules! uint_impl {
18001807
#[rustc_const_stable(feature = "const_overflowing_int_methods", since = "1.52.0")]
18011808
#[must_use = "this returns the result of the operation, \
18021809
without modifying the original"]
1810+
#[track_caller]
18031811
pub const fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
18041812
(self % rhs, false)
18051813
}
@@ -1830,6 +1838,7 @@ macro_rules! uint_impl {
18301838
#[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.52.0")]
18311839
#[must_use = "this returns the result of the operation, \
18321840
without modifying the original"]
1841+
#[track_caller]
18331842
pub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
18341843
(self % rhs, false)
18351844
}
@@ -2065,7 +2074,7 @@ macro_rules! uint_impl {
20652074
#[must_use = "this returns the result of the operation, \
20662075
without modifying the original"]
20672076
#[inline(always)]
2068-
#[rustc_inherit_overflow_checks]
2077+
#[track_caller]
20692078
pub const fn div_euclid(self, rhs: Self) -> Self {
20702079
self / rhs
20712080
}
@@ -2094,7 +2103,7 @@ macro_rules! uint_impl {
20942103
#[must_use = "this returns the result of the operation, \
20952104
without modifying the original"]
20962105
#[inline(always)]
2097-
#[rustc_inherit_overflow_checks]
2106+
#[track_caller]
20982107
pub const fn rem_euclid(self, rhs: Self) -> Self {
20992108
self % rhs
21002109
}
@@ -2119,6 +2128,7 @@ macro_rules! uint_impl {
21192128
#[must_use = "this returns the result of the operation, \
21202129
without modifying the original"]
21212130
#[inline(always)]
2131+
#[track_caller]
21222132
pub const fn div_floor(self, rhs: Self) -> Self {
21232133
self / rhs
21242134
}
@@ -2146,7 +2156,7 @@ macro_rules! uint_impl {
21462156
#[must_use = "this returns the result of the operation, \
21472157
without modifying the original"]
21482158
#[inline]
2149-
#[rustc_inherit_overflow_checks]
2159+
#[track_caller]
21502160
pub const fn div_ceil(self, rhs: Self) -> Self {
21512161
let d = self / rhs;
21522162
let r = self % rhs;

0 commit comments

Comments
 (0)