Skip to content

Commit

Permalink
Auto merge of rust-lang#23251 - tbu-:pr_rm_core_str_checked_add, r=al…
Browse files Browse the repository at this point in the history
…excrichton
  • Loading branch information
bors committed Mar 11, 2015
2 parents cfea8ec + 5199a70 commit f899513
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down

0 comments on commit f899513

Please sign in to comment.