about summary refs log tree commit diff
path: root/src/liballoc/linked_list.rs
AgeCommit message (Collapse)AuthorLines
2018-06-29Move some alloc crate top-level items to a new alloc::collections moduleSimon Sapin-1486/+0
This matches std::collections
2018-04-16Auto merge of #48945 - clarcharr:iter_exhaust, r=Kimundibors-1/+1
Replace manual iterator exhaust with for_each(drop) This originally added a dedicated method, `Iterator::exhaust`, and has since been replaced with `for_each(drop)`, which is more idiomatic. <del>This is just shorthand for `for _ in &mut self {}` or `while let Some(_) = self.next() {}`. This states the intent a lot more clearly than the identical code: run the iterator to completion. <del>At least personally, my eyes tend to gloss over `for _ in &mut self {}` without fully paying attention to what it does; having a `Drop` implementation akin to: <del>`for _ in &mut self {}; unsafe { free(self.ptr); }`</del> <del>Is not as clear as: <del>`self.exhaust(); unsafe { free(self.ptr); }` <del>Additionally, I've seen debate over whether `while let Some(_) = self.next() {}` or `for _ in &mut self {}` is more clear, whereas `self.exhaust()` is clearer than both.
2018-04-04Replace manual iter exhaust with for_each(drop).Clar Charr-1/+1
2018-04-03Remove all unstable placement featuresAidan Hobson Sayers-176/+2
Closes #22181, #27779
2018-03-03core: Update stability attributes for FusedIteratorUlrik Sverdrup-3/+3
2018-03-03core: Stabilize FusedIteratorUlrik Sverdrup-3/+3
FusedIterator is a marker trait that promises that the implementing iterator continues to return `None` from `.next()` once it has returned `None` once (and/or `.next_back()`, if implemented). The effects of FusedIterator are already widely available through `.fuse()`, but with stable `FusedIterator`, stable Rust users can implement this trait for their iterators when appropriate.
2018-02-22[docs] Minor wording changes to drain_filter docsMatt Brubeck-2/+2
The docs currently say, "If the closure returns false, it will try again, and call the closure on the next element." But this happens regardless of whether the closure returns true or false.
2018-01-24Auto merge of #47299 - cramertj:unsafe-placer, r=alexcrichtonbors-2/+2
Make core::ops::Place an unsafe trait Consumers of `Place` would reasonably expect that the `pointer` function returns a valid pointer to memory that can actually be written to.
2018-01-20Rename Box::into_non_null_raw to Box::into_raw_non_nullSimon Sapin-3/+3
2018-01-20Rename Box::*_nonnull_raw to *_non_null_rawSimon Sapin-3/+3
2018-01-20Replace Box::{from,into}_unique with {from,into}_nonnull_rawSimon Sapin-4/+4
Thew `_raw` prefix is included because the fact that `Box`’s ownership semantics are "dissolved" or recreated seem more important than the exact parameter type or return type.
2018-01-20Rename std::ptr::Shared to NonNullSimon Sapin-14/+14
`Shared` is now a deprecated `type` alias. CC https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629
2018-01-09Make core::ops::Place an unsafe traitTaylor Cramer-2/+2
2017-12-09Revert "Make drop impl stable for DrainFilter"Thayne McCombs-1/+1
This reverts commit 00acdbd51decd75ad10815ce7bcf3323830f95d6.
2017-12-07Make drop impl stable for DrainFilterThayne McCombs-1/+1
2017-12-07Add Drop impl for linked_list::DrainFilterThayne McCombs-0/+9
2017-11-28Rollup merge of #46262 - udoprog:linked-list-remove-if, r=dtolnaykennytm-0/+139
Introduce LinkedList::drain_filter This introduces `LinkedList::remove_if`. This operation embodies one of the use-cases where `LinkedList` would typically be preferred over `Vec`: random removal and retrieval. There are a number of considerations with this: Should there be two `remove_if` methods? One where elements are only removed, one which returns a collection of removed elements. Should this be implemented using a draining iterator pattern that covers both cases? I suspect that would incur a bit of overhead (moving the element into the iterator, then into a new collection). But I'm not sure. Maybe that's an acceptable compromise to maximize flexibility. I don't feel I've had enough exposure to unsafe programming in rust to be certain the implementation is correct. This relies quite heavily on moving around copies of Shared pointers to make the code reasonable. Please help me out :).
2017-11-26Check tail node in check_linksJohn-John Tedro-0/+7
2017-11-25Implement LinkedList::drain_filterJohn-John Tedro-35/+95
Relates to rust-lang/rfcs#2140 - drain_filter for all collections `drain_filter` is implemented instead of `LinkedList::remove_if` based on review feedback.
2017-11-25Introduce LinkedList::remove_ifJohn-John Tedro-0/+79
2017-11-08std: Remove `rand` crate and moduleAlex Crichton-1/+2
This commit removes the `rand` crate from the standard library facade as well as the `__rand` module in the standard library. Neither of these were used in any meaningful way in the standard library itself. The only need for randomness in libstd is to initialize the thread-local keys of a `HashMap`, and that unconditionally used `OsRng` defined in the standard library anyway. The cruft of the `rand` crate and the extra `rand` support in the standard library makes libstd slightly more difficult to port to new platforms, namely WebAssembly which doesn't have any randomness at all (without interfacing with JS). The purpose of this commit is to clarify and streamline randomness in libstd, focusing on how it's only required in one location, hashmap seeds. Note that the `rand` crate out of tree has almost always been a drop-in replacement for the `rand` crate in-tree, so any usage (accidental or purposeful) of the crate in-tree should switch to the `rand` crate on crates.io. This then also has the further benefit of avoiding duplication (mostly) between the two crates!
2017-09-30address some `FIXME`s whose associated issues were marked as closedNiv Kaminer-1/+1
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays. remove FIXME(#19649) now that stability markers render. remove FIXME(#13642) now the benchmarks were moved. remove FIXME(#6220) now that floating points can be formatted. remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>` remove reference to irelevent issues in FIXME(#1697, #2178...) update FIXME(#5516) to point to getopts issue 7 update FIXME(#7771) to point to RFC 628 update FIXME(#19839) to point to issue 26925
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-07-22Add Box::into_uniqueSimon Sapin-3/+3
2017-07-22Rename {NonZero,Shared,Unique}::new to new_uncheckedSimon Sapin-3/+3
2017-06-13Merge crate `collections` into `alloc`Murarth-0/+1504