diff options
| author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2014-09-12 15:03:50 +0200 |
|---|---|---|
| committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2014-09-12 15:03:50 +0200 |
| commit | 259930e2a304249d9b06557e6d25cab651e0860b (patch) | |
| tree | 6ad150c48ba227a4e0f5d1f774b605a31121b3c2 /src/libcore | |
| parent | 22e749ded10822a3063fa26800aaa3f229e97c4d (diff) | |
Document why `core::str::Searcher::new` doesn't overflow
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/str.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs index d6f35b0dcc6..6837f3b9af7 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -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 { |
