Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #89589

Closed
wants to merge 24 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
18df8d6
Expand documentation for `FpCategory`.
kpreid Aug 31, 2021
25b6f9b
print-type-sizes: skip field printing for primitives
tmiasko Sep 28, 2021
fe11483
Add functions to add unsigned and signed integers
a1phyr Jul 29, 2021
ab9f8a0
Apply suggestion for `overflowing_add_signed`
a1phyr Jul 30, 2021
b5dd522
Fix doc test
a1phyr Aug 7, 2021
9faf621
Add methods to add/sub `uX` to/from `iX`
a1phyr Aug 7, 2021
70e55a8
Apply suggestions
a1phyr Oct 3, 2021
4846fd9
Revert suggested use of `unwrap_or`
a1phyr Oct 3, 2021
47edde1
Optimize `saturating_add_signed`
a1phyr Oct 4, 2021
388bcc1
Fix suggestion to borrow when casting from pointer to reference
FabianWolff Oct 4, 2021
c79447e
library std, libc dependency update
devnexen Oct 4, 2021
b2e4e59
refactor: VecDeques Drain fields to private
DeveloperC286 Sep 17, 2021
5af61cb
refactor: VecDeques IterMut fields to private
DeveloperC286 Sep 25, 2021
3c974ad
Note specific regions involved in 'borrowed data escapes' error
Aaron1011 Oct 3, 2021
edfd6d5
test
BoxyUwU Oct 6, 2021
0c78e9d
Rollup merge of #87601 - a1phyr:feature_uint_add_signed, r=kennytm
Manishearth Oct 6, 2021
142da32
Rollup merge of #88523 - kpreid:category, r=yaahc
Manishearth Oct 6, 2021
de72bc4
Rollup merge of #89050 - DeveloperC286:drain_fields_to_private, r=jos…
Manishearth Oct 6, 2021
9f0fd13
Rollup merge of #89245 - DeveloperC286:iter_mut_fields_to_private, r=…
Manishearth Oct 6, 2021
2195bab
Rollup merge of #89329 - tmiasko:print-type-sizes-no-fields, r=jackh726
Manishearth Oct 6, 2021
666f91b
Rollup merge of #89501 - Aaron1011:escaping-name-regions, r=davidtwco
Manishearth Oct 6, 2021
8f1d942
Rollup merge of #89528 - FabianWolff:issue-89497, r=jackh726
Manishearth Oct 6, 2021
fd3f945
Rollup merge of #89531 - devnexen:stack_overflow_bsd_libc_upd, r=dtolnay
Manishearth Oct 6, 2021
fe52017
Rollup merge of #89588 - BoxyUwU:add_a_test_uwu, r=lcnr
Manishearth Oct 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
@@ -1037,10 +1037,13 @@ macro_rules! uint_impl {
without modifying the original"]
#[inline]
pub const fn saturating_add_signed(self, rhs: $SignedT) -> Self {
if rhs >= 0 {
self.saturating_add(rhs as Self)
let (res, overflow) = self.overflowing_add(rhs as Self);
if overflow == (rhs < 0) {
res
} else if overflow {
Self::MAX
} else {
self.saturating_sub(rhs.unsigned_abs())
0
}
}