about summary refs log tree commit diff
path: root/src/libstd/collections
AgeCommit message (Collapse)AuthorLines
2018-09-05fixup Debug boundsAlexis Beingessner-2/+2
2018-09-05progress on raw_entryAlexis Beingessner-229/+231
2018-09-05WIP: add raw_entry API to HashMapAlexis Beingessner-37/+703
2018-08-29fix some uses of pointer intrinsics with invalid pointersRalf Jung-1/+3
2018-08-20Replace usages of ptr::offset with ptr::{add,sub}.Corey Farwell-2/+2
2018-06-29Move core::alloc::CollectionAllocErr to alloc::collectionsSimon Sapin-3/+4
2018-06-29Move some alloc crate top-level items to a new alloc::collections moduleSimon Sapin-4/+4
This matches std::collections
2018-06-19Auto merge of #51543 - SimonSapin:oom, r=SimonSapinbors-2/+2
Rename OOM to allocation error The acronym is not descriptive unless one has seen it before. * Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle. * Rename `set_oom_hook` to `set_alloc_error_hook` * Rename `take_oom_hook` to `take_alloc_error_hook` Bikeshed: `on` v.s. `for`, `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-18Rename OOM to allocation errorSimon Sapin-2/+2
The acronym is not descriptive unless one has seen it before. * Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle. * Rename `set_oom_hook` to `set_alloc_error_hook` * Rename `take_oom_hook` to `take_alloc_error_hook` Bikeshed: `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-18Prefer use of owned values in examplesKornel-23/+37
2018-06-11Remove deprecated heap modulesSimon Sapin-1/+1
The heap.rs file was already unused.
2018-06-11Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAllocMike Hommey-1/+1
2018-06-10Stabilize entry-or-defaultGuillaume Gomez-3/+1
2018-06-04Optimize layout calculations in HashMapAmanieu d'Antras-3/+16
This now produces the same assembly code as the previous implementation.
2018-06-02Add a couple lines describing differences between into_mut/get_mut.Corey Farwell-0/+9
2018-06-02Fixed typoPhlosioneer-1/+1
2018-06-02Clarify the difference between get_mut and into_mut for OccupiedEntryPhlosioneer-2/+6
The examples for both hash_map::OccupiedEntry::get_mut and hash_map::OccupiedEntry::into_mut were almost identical. This led to some confusion over the difference, namely why you would ever use get_mut when into_mut gives alonger lifetime. Reddit thread: https://www.reddit.com/r/rust/comments/8a5swr/why_does_hashmaps This commit adds two lines and a comment to the example, to show that the entry object can be re-used after calling get_mut.
2018-06-01Simplify HashMap layout calculation by using LayoutAmanieu d'Antras-107/+13
2018-05-30Pass a `Layout` to `oom`Mike Hommey-21/+61
As discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-384893456 and subsequent, there are use-cases where the OOM handler needs to know the size of the allocation that failed. The alignment might also be a cause for allocation failure, so providing it as well can be useful.
2018-05-24remove collections::range::RangeArgumentCory Sherman-8/+0
was already moved to ops::RangeBounds (see #30877)
2018-05-01Rollup merge of #50316 - ehuss:fix-doc-links, r=frewsxcvkennytm-1/+1
Fix some broken links in docs.
2018-04-29Fix some broken links in docs.Eric Huss-1/+1
2018-04-28std: Inline `DefaultResizePolicy::new`Alex Crichton-0/+1
This should allow us to tighten up the [codegen][example] a bit more, avoiding a function call across object boundaries in the default optimized case. [example]: https://play.rust-lang.org/?gist=c1179088b0f8a4dcd93a9906463f993d&version=stable&mode=release
2018-04-22Replace GlobalAlloc::oom with a lang itemSteven Fackler-5/+5
2018-04-20Auto merge of #50088 - alexcrichton:std-tweaks, r=sfacklerbors-2/+2
Tweak some stabilizations in libstd 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-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-17stabilize `hash_map_remove_entry` featuretinaun-2/+1
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-12Rename alloc::Void to alloc::OpaqueSimon Sapin-1/+1
2018-04-12Use NonNull<Void> instead of *mut u8 in the Alloc traitMike Hommey-4/+2
Fixes #49608
2018-04-12Return Result instead of Option in alloc::Layout constructorsSimon Sapin-1/+1
2018-04-12Remove the now-unit-struct AllocErr field inside CollectionAllocErrSimon Sapin-4/+4
2018-04-12Remove the now-unit-struct AllocErr parameter of oom()Simon Sapin-3/+3
2018-04-12Actually deprecate the Heap typeSimon Sapin-8/+8
2018-04-12Import the `alloc` crate as `alloc_crate` in stdSimon Sapin-12/+7
… to make the name `alloc` available.
2018-04-04Replace manual iter exhaust with for_each(drop).Clar Charr-1/+1
2018-04-03Remove all unstable placement featuresAidan Hobson Sayers-176/+1
Closes #22181, #27779
2018-04-02Use Alloc and Layout from core::heap.Mike Hommey-2/+4
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-29Hide the Bound type in docs at its deprecated location in std::collectionsSimon Sapin-0/+1
2018-03-29Hide the deprecated std::collections::range module from docsSimon Sapin-0/+1
2018-03-29Move RangeArguments to {core::std}::ops and rename to RangeBoundsSimon Sapin-2/+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-1/+2
The stable reexport `std::collections::Bound` is now deprecated. Another deprecated reexport could be added in `alloc`, but that crate is unstable.
2018-03-28Rollup merge of #49400 - Diggsey:shrink-to, r=joshtriplettkennytm-0/+68
Implement `shrink_to` method on collections Fixes #49385
2018-03-27Implement `shrink_to` method on collectionsDiggory Blake-0/+68
2018-03-25Implement get_key_value for HashMap, BTreeMapDiggory Blake-0/+28
2018-03-15setting ABORTING_MALLOC for asmjs backendsnf-4/+0
2018-03-14try_reserve: disabling tests for asmjs, blocked by #48968snf-0/+4
2018-03-14implementing fallible allocation API (try_reserve) for Vec, String and HashMapsnf-29/+127
2018-03-06Rollup merge of #47463 - bluss:fused-iterator, r=alexcrichtonkennytm-14/+14
Stabilize FusedIterator 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. Closes #35602
2018-03-05Remove a couple of `isize` references from hashmap docsTobias Bucher-29/+29
Also fix a spelling mistake.