]> git.lizzy.rs Git - rust.git/commitdiff
Document why `core::str::Searcher::new` doesn't overflow
authorTobias Bucher <tobiasbucher5991@gmail.com>
Fri, 12 Sep 2014 13:03:50 +0000 (15:03 +0200)
committerTobias Bucher <tobiasbucher5991@gmail.com>
Fri, 12 Sep 2014 13:03:50 +0000 (15:03 +0200)
src/libcore/str.rs

index d6f35b0dcc65053c874715fd8458a833b0cebd38..6837f3b9af7fa80521c3c00f02f52084f83bec12 100644 (file)
@@ -574,6 +574,9 @@ enum Searcher {
 impl Searcher {
     fn new(haystack: &[u8], needle: &[u8]) -> Searcher {
         // FIXME: Tune this.
+        // FIXME(#16715): This unsigned integer addition will probably not
+        // overflow because that would mean that the memory almost solely
+        // consists of the needle. Needs #16715 to be formally fixed.
         if needle.len() + 20 > haystack.len() {
             Naive(NaiveSearcher::new())
         } else {