about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-07-24 18:56:38 +0900
committerGitHub <noreply@github.com>2020-07-24 18:56:38 +0900
commitfab9b1d4cd5a788f46d94077b49da285ce782b74 (patch)
treedd0eeeddbd39e82beb10ccd52d81f69c75e1ab8b /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parent7f2bb29907c333ebb71e0cf651302ebc4fc0cb1e (diff)
parentfacc46fd0a85408bc05aa19b80131e3cfb5fe3dd (diff)
downloadrust-fab9b1d4cd5a788f46d94077b49da285ce782b74.tar.gz
rust-fab9b1d4cd5a788f46d94077b49da285ce782b74.zip
Rollup merge of #74677 - ssomers:btree_cleanup_2, r=Amanieu
Remove needless unsafety from BTreeMap::drain_filter

Remove one piece of unsafe code in the iteration over the iterator returned by BTreeMap::drain_filter.
- Changes an explicitly unspecified part of the API: when the user-supplied predicate (or some of BTreeMap's code) panicked, and the caller tries to use the iterator again, we no longer offer the same key/value pair to the predicate again but pretend the iterator has finished. Note that Miri does not find UB in the test case added here with the unsafe code (or without).
- Makes the code a little easier on the eyes.
- Makes the code a little harder on the CPU:
```
benchcmp c0 c2 --threshold 3
 name                                         c0 ns/iter  c2 ns/iter  diff ns/iter  diff %  speedup
 btree::set::clone_100_and_drain_all          2,794       2,900                106   3.79%   x 0.96
 btree::set::clone_100_and_drain_half         2,604       2,964                360  13.82%   x 0.88
 btree::set::clone_10k_and_drain_half         287,770     322,755           34,985  12.16%   x 0.89
```
r? @Amanieu
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions