Auto merge of #23251 - tbu-:pr_rm_core_str_checked_add, r=alexcrichton
This commit is contained in:
commit
f899513a30
|
@ -442,7 +442,10 @@ impl<'a> Iterator for Chars<'a> {
|
|||
#[inline]
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
let (len, _) = self.iter.size_hint();
|
||||
(len.saturating_add(3) / 4, Some(len))
|
||||
// `(len + 3)` can't overflow, because we know that the `slice::Iter`
|
||||
// belongs to a slice in memory which has a maximum length of
|
||||
// `isize::MAX` (that's well below `usize::MAX`).
|
||||
((len + 3) / 4, Some(len))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue