about summary refs log tree commit diff
path: root/src/liballoc/btree
AgeCommit message (Collapse)AuthorLines
2018-06-29Move some alloc crate top-level items to a new alloc::collections moduleSimon Sapin-5451/+0
This matches std::collections
2018-06-11Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAllocMike Hommey-5/+5
2018-06-10Stabilize entry-or-defaultGuillaume Gomez-2/+1
2018-06-02Copy changes from HashMap over to BTreeMap.Corey Farwell-2/+15
2018-05-24stabilize RangeBounds collections_range #30877Cory Sherman-3/+3
rename RangeBounds::start() -> start_bound() rename RangeBounds::end() -> end_bound()
2018-05-08Make an ensure_root_is_owned method to reduce duplicationC Jones-15/+10
Also remove some unnecessary debug_assert! when creating the shared root, since the root should be stored in the rodata and thus be impossible to accidentally modify.
2018-05-07Add debug asserts and fix some violationsC Jones-0/+16
2018-05-07Make into_key_slice avoid taking out-of-bounds pointersC Jones-14/+34
2018-05-07Split into_slices() to avoid making extra slicesC Jones-25/+41
This splits into_slices() into into_key_slice() and into_val_slice(). While the extra calls would get optimized out, this is a useful semantic change since we call keys() while iterating, and we don't want to construct and out-of-bounds val() pointer in the process if we happen to be pointing to the shared static root. This also paves the way for doing the alignment handling conditional differently for the keys and values.
2018-05-07Don't drop the shared static nodeC Jones-8/+13
We modify the drop implementation in IntoIter to not drop the shared root
2018-05-07Add a statically allocated empty node for empty mapsC Jones-2/+43
This gives a pointer to that static empty node instead of allocating a new node, and then whenever inserting makes sure that the root isn't that empty node.
2018-05-07Make LeafNode #[repr(C)] and put the metadata before generic itemsC Jones-8/+12
This way we can safely statically allocate a LeafNode to use as the placeholder before allocating, and any type accessing it will be able to access the metadata at the same offset.
2018-04-19Tweak some stabilizations in libstdAlex Crichton-2/+2
This commit tweaks a few stable APIs in the `beta` branch before they hit stable. The `str::is_whitespace` and `str::is_alphanumeric` functions were deleted (added in #49381, issue at #49657). The `and_modify` APIs added in #44734 were altered to take a `FnOnce` closure rather than a `FnMut` closure. Closes #49581 Closes #49657
2018-04-16Auto merge of #48945 - clarcharr:iter_exhaust, r=Kimundibors-2/+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-12Rename alloc::Void to alloc::OpaqueSimon Sapin-5/+5
2018-04-12Use NonNull<Void> instead of *mut u8 in the Alloc traitMike Hommey-8/+8
Fixes #49608
2018-04-12Actually deprecate the Heap typeSimon Sapin-7/+6
2018-04-04Replace manual iter exhaust with for_each(drop).Clar Charr-2/+1
2018-04-02Use Alloc and Layout from core::heap.Mike Hommey-1/+2
94d1970bba87f2d2893f6e934e4c3f02ed50604d moved the alloc::allocator module to core::heap, moving e.g. Alloc and Layout out of the alloc crate. While alloc::heap reexports them, it's better to use them from where they really come from.
2018-03-29Move RangeArguments to {core::std}::ops and rename to RangeBoundsSimon Sapin-7/+6
These unstable items are deprecated: * The `std::collections::range::RangeArgument` reexport * The `std::collections::range` module.
2018-03-29Move alloc::Bound to {core,std}::opsSimon Sapin-3/+3
The stable reexport `std::collections::Bound` is now deprecated. Another deprecated reexport could be added in `alloc`, but that crate is unstable.
2018-03-25Implement get_key_value for HashMap, BTreeMapDiggory Blake-0/+27
2018-03-17Use NonNull<_> instead of NonZero<*const _> in btree internalsSimon Sapin-16/+14
2018-03-03core: Update stability attributes for FusedIteratorUlrik Sverdrup-15/+15
2018-03-03core: Stabilize FusedIteratorUlrik Sverdrup-15/+15
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-251.25.0 -> 1.26.-Manish Goregaokar-1/+1
2018-02-12Stabilize 'entry_and_modify' feature for BTreeMaphedgehog1024-2/+1
2018-01-28Document that `Index` ops can panic on `HashMap` & `BTreeMap`.Corey Farwell-0/+5
Fixes https://github.com/rust-lang/rust/issues/47011.
2018-01-20fix doctests for BTreeSet to use BTreeSet (not BTreeMap)Andrew Straw-12/+12
This fixes #47624
2018-01-05Write examples for {BTree,Hash}Set::{get,replace,take}Stjepan Glavina-0/+33
2018-01-03Remove `T: Ord` bound from `BTreeSet::{is_empty, len}`Stjepan Glavina-72/+68
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-10/+4
2017-10-06Implement `entry_and_modify`mchlrhw-0/+34
2017-09-13Remove unneeded `loop`.Corey Farwell-8/+6
2017-09-05Avoid weird or_insert_with exampleJon Gjengset-3/+1
2017-09-05Add or_default to Entry APIsJon Gjengset-0/+29
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-1/+1
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-14/+14
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-1/+1
2017-08-12Auto merge of #43794 - Eijebong:fix_typos, r=lukaramu,steveklanik,imperiobors-2/+2
Fix some typos I wrote a really naive script and found those typos in the documentation.
2017-08-11Fix some typosBastien Orivel-2/+2
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-2/+2
2017-07-22Use checked NonZero constructor instead of explicit null check in btreeSimon Sapin-6/+4
2017-07-22Add conversions from references to NonZero pointers, Unique, and SharedSimon Sapin-1/+1
2017-07-22Add Box::into_uniqueSimon Sapin-3/+1
2017-07-22Rename {NonZero,Shared,Unique}::new to new_uncheckedSimon Sapin-5/+5
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-18/+8
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-30Revert "Stabilize RangeArgument"Steven Fackler-3/+5
This reverts commit 143206d54d7558c2326212df99efc98110904fdb.
2017-06-24Stabilize RangeArgumentSteven Fackler-5/+3
Move it and Bound to core::ops while we're at it. Closes #30877
2017-06-23Relax Debug constraints when debugging {HashMap,BTreeMap}::{Keys,Values}.Federico Ravasio-2/+2
Fixed #41924.