Skip to content

Commit 259930e

Browse files
committed
Document why core::str::Searcher::new doesn't overflow
1 parent 22e749d commit 259930e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libcore/str.rs

+3
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,9 @@ enum Searcher {
574574
impl Searcher {
575575
fn new(haystack: &[u8], needle: &[u8]) -> Searcher {
576576
// FIXME: Tune this.
577+
// FIXME(#16715): This unsigned integer addition will probably not
578+
// overflow because that would mean that the memory almost solely
579+
// consists of the needle. Needs #16715 to be formally fixed.
577580
if needle.len() + 20 > haystack.len() {
578581
Naive(NaiveSearcher::new())
579582
} else {

0 commit comments

Comments
 (0)