rust/src/liballoc/tests
Yuki Okushi fab9b1d4cd
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
2020-07-24 18:56:38 +09:00
..
btree Rollup merge of #74677 - ssomers:btree_cleanup_2, r=Amanieu 2020-07-24 18:56:38 +09:00
arc.rs Use assoc const f32::NAN in liballoc 2020-04-06 22:44:04 +02:00
binary_heap.rs Rollup merge of #71485 - arlopurcell:binary_heap_retain, r=Amanieu 2020-04-25 01:35:59 +02:00
borrow.rs Add tests from Cow 2020-04-22 14:16:21 -07:00
boxed.rs Remove flaky test and document the other's flakiness 2020-05-29 11:24:26 +01:00
cow_str.rs Small Cow improvements 2019-12-11 21:01:33 +01:00
fmt.rs Remove licenses 2018-12-25 21:08:33 -07:00
heap.rs Make fields in MemoryBlock public 2020-03-28 20:22:07 +01:00
lib.rs Remove uses of Vec::remove_item 2020-06-20 12:12:28 +02:00
linked_list.rs Format 2020-01-19 20:50:00 +01:00
rc.rs Use assoc const f32::NAN in liballoc 2020-04-06 22:44:04 +02:00
slice.rs liballoc: more compact way to adjust test sizes for Miri 2020-04-23 20:05:01 +02:00
str.rs Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
string.rs add test for char into string 2020-06-18 11:19:03 +02:00
vec.rs Rollup merge of #71660 - sollyucko:master, r=dtolnay 2020-06-22 14:53:46 +02:00
vec_deque.rs liballoc: more compact way to adjust test sizes for Miri 2020-04-23 20:05:01 +02:00