about summary refs log tree commit diff
path: root/src/libstd/collections/hash
AgeCommit message (Collapse)AuthorLines
2015-10-06Add RFC 1238's `unsafe_destructor_blind_to_params` (UGEH) where needed.Felix S. Klock II-0/+1
I needed it in `RawVec`, `Vec`, and `TypedArena` for `rustc` to bootstrap; but of course that alone was not sufficient for `make check`. Later I added `unsafe_destructor_blind_to_params` to collections, in particular `LinkedList` and `RawTable` (the backing representation for `HashMap` and `HashSet`), to get the regression tests exercising cyclic structure from PR #27185 building. ---- Note that the feature is `dropck_parametricity` (which is not the same as the attribute's name). We will almost certainly vary our strategy here in the future, so it makes some sense to have a not-as-ugly name for the feature gate. (The attribute name was deliberately selected to be ugly looking.)
2015-09-29Remove redundant uses of Iterator::by_ref()Ulrik Sverdrup-1/+1
2015-09-11std: Internalize almost all of `std::rt`Alex Crichton-8/+5
This commit does some refactoring to make almost all of the `std::rt` private. Specifically, the following items are no longer part of its API: * DEFAULT_ERROR_CODE * backtrace * unwind * args * at_exit * cleanup * heap (this is just alloc::heap) * min_stack * util The module is now tagged as `#[doc(hidden)]` as the only purpose it's serve is an entry point for the `panic!` macro via the `begin_unwind` and `begin_unwind_fmt` reexports.
2015-08-31Implement RFC 839 for `{HashMap, HashSet}`Andrew Paseltiner-0/+62
It appears that these impls were left out of #25989 by mistake.
2015-08-28implement RFC 1194Andrew Paseltiner-4/+105
2015-08-15std: Add issues to all unstable featuresAlex Crichton-11/+22
2015-08-14Auto merge of #27822 - arielb1:inline-round-take-2, r=Gankrobors-0/+1
This speeds up rustc on #25916 from 1.36±0.022s to 1.326±0.025s Tests pass locally (even on 32-bit :-) r? @Gankro
2015-08-13Mark round_up_to_next as inline arielb1-0/+1
This speeds up rustc on #25916 from 1.36±0.022s to 1.326±0.025s Tests pass locally (even on 32-bit :-)
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-14/+2
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-11Add HashSet and HashMap testsGuillaume Gomez-25/+15
2015-08-10Add Send/Sync traits on Iter struct in hash/tableGuillaume Gomez-1/+25
2015-07-27Show appropriate feature flags in docsSteve Klabnik-5/+10
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-3/+3
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)
2015-07-06typo "struct has is 0-sized"Oliver Schneider-1/+1
2015-06-24Make `align_of` behave like `min_align_of`.Huon Wilson-11/+11
This removes a footgun, since it is a reasonable assumption to make that pointers to `T` will be aligned to `align_of::<T>()`. This also matches the behaviour of C/C++. `min_align_of` is now deprecated. Closes #21611.
2015-06-17std: Split the `std_misc` featureAlex Crichton-21/+22
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-6/+6
2015-05-31Inline hash_table::calculate_offsets, used by iterators.Eduard Burtescu-0/+1
The `HashMap` and `HashSet` iterators use `RawTable::first_bucket_raw` which is generic and will get inlined cross-crate. However, `first_bucket_raw` calls `calculate_offsets` and the call doesn't get inlined, despite being a simple function. This missing `#[inline]` results in `hash_table::calculate_offsets` showing up at the top of a callgrind profile with 3 million calls (for the testcase in #25916).
2015-05-17Make debug builders take &mut self, add entries methodSteven Fackler-2/+2
[breaking-change]
2015-05-16Small typo in the docsEmilio Cobos Álvarez-1/+1
Just detected it while reading.
2015-05-10Rollup merge of #25240 - bluss:doc-hashmap-entry, r=steveklabnikSteve Klabnik-0/+18
Add example for HashMap::entry()
2015-05-09std: Add example for HashMap::entry()Ulrik Sverdrup-0/+18
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-1/+1
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-05-05Rollup merge of #25074 - killercup:patch-10, r=alexcrichtonManish Goregaokar-19/+22
Sweeten the two main HashMap/HashSet examples from [here](http://doc.rust-lang.org/std/collections/struct.HashMap.html) and [here](http://doc.rust-lang.org/std/collections/struct.HashSet.html) with some deref and loop sugar. (I've only tested this using [this playpen][1].) [1]: https://play.rust-lang.org/?code=fn%20main()%20%7B%0A%20%20%20%20use%20std%3A%3Acollections%3A%3AHashMap%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20type%20inference%20lets%20us%20omit%20an%20explicit%20type%20signature%20(which%0A%20%20%20%20%2F%2F%20would%20be%20%60HashMap%3C%26str%2C%20%26str%3E%60%20in%20this%20example).%0A%20%20%20%20let%20mut%20book_reviews%20%3D%20HashMap%3A%3Anew()%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20review%20some%20books.%0A%20%20%20%20book_reviews.insert(%22Adventures%20of%20Huckleberry%20Finn%22%2C%20%20%20%20%22My%20favorite%20book.%22)%3B%0A%20%20%20%20book_reviews.insert(%22Grimms%27%20Fairy%20Tales%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Masterpiece.%22)%3B%0A%20%20%20%20book_reviews.insert(%22Pride%20and%20Prejudice%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Very%20enjoyable.%22)%3B%0A%20%20%20%20book_reviews.insert(%22The%20Adventures%20of%20Sherlock%20Holmes%22%2C%20%22Eye%20lyked%20it%20alot.%22)%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20check%20for%20a%20specific%20one.%0A%20%20%20%20if%20!book_reviews.contains_key(%26(%22Les%20Mis%C3%A9rables%22))%20%7B%0A%20%20%20%20%20%20%20%20println!(%22We%27ve%20got%20%7B%7D%20reviews%2C%20but%20Les%20Mis%C3%A9rables%20ain%27t%20one.%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20book_reviews.len())%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20oops%2C%20this%20review%20has%20a%20lot%20of%20spelling%20mistakes%2C%20let%27s%20delete%20it.%0A%20%20%20%20book_reviews.remove(%26(%22The%20Adventures%20of%20Sherlock%20Holmes%22))%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20look%20up%20the%20values%20associated%20with%20some%20keys.%0A%20%20%20%20let%20to_find%20%3D%20%5B%22Pride%20and%20Prejudice%22%2C%20%22Alice%27s%20Adventure%20in%20Wonderland%22%5D%3B%0A%20%20%20%20for%20book%20in%20to_find.iter()%20%7B%0A%20%20%20%20%20%20%20%20match%20book_reviews.get(book)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Some(review)%20%3D%3E%20println!(%22%7B%7D%3A%20%7B%7D%22%2C%20*book%2C%20*review)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20None%20%3D%3E%20println!(%22%7B%7D%20is%20unreviewed.%22%2C%20*book)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20iterate%20over%20everything.%0A%20%20%20%20for%20(book%2C%20review)%20in%20book_reviews.iter()%20%7B%0A%20%20%20%20%20%20%20%20println!(%22%7B%7D%3A%20%5C%22%7B%7D%5C%22%22%2C%20*book%2C%20*review)%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%7D
2015-05-03Fix Derive Notice for HashSetPascal Hertleif-2/+2
2015-05-03Fix Derive Notice for HashMapPascal Hertleif-2/+3
2015-05-03Clean up HashSet ExamplesPascal Hertleif-5/+5
2015-05-03HashSet Docs: Split First ParagraphPascal Hertleif-4/+6
This way, the module index renders only the first sentence as a short description.
2015-05-03Clean up HashMap examplesPascal Hertleif-8/+8
2015-05-03Restore HashMap performance by allowing some functions to be inlinedBjörn Steinbrink-0/+1
Since the hashmap and its hasher are implemented in different crates, we currently can't benefit from inlining, which means that especially for small, fixed size keys, there is a huge overhead in hash calculations, because the compiler can't apply optimizations that only apply for these keys. Fixes the brainfuck benchmark in #24014.
2015-05-01std: Remove index notation on slice iteratorsAlex Crichton-2/+1
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791
2015-04-28Register new snapshotsTamir Duberstein-2/+0
2015-04-21rollup merge of #24636: alexcrichton/remove-deprecatedAlex Crichton-3/+3
Conflicts: src/libcore/result.rs
2015-04-21rollup merge of #24541: alexcrichton/issue-24538Alex Crichton-57/+47
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-21std: Bring back f32::from_str_radix as an unstable APIAlex Crichton-2/+2
This API was exercised in a few tests and mirrors the `from_str_radix` functionality of the integer types.
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-1/+1
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-6/+0
2015-04-18Utilize if..let for get_mut doc-comment examplesCorey Farwell-3/+2
2015-04-17std: Add Default/IntoIterator/ToOwned to the preludeAlex Crichton-57/+47
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-16Fixed typo in hash_map::Entry documentationAram Visser-1/+0
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-14rollup merge of #24377: apasel422/docsAlex Crichton-8/+8
Conflicts: src/libstd/net/ip.rs src/libstd/sys/unix/fs.rs src/libstd/sys/unix/mod.rs src/libstd/sys/windows/mod.rs
2015-04-14test: Fixup many library unit testsAlex Crichton-2/+2
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-8/+8
2015-04-10Fix some typosTibor Benke-1/+1
Signed-off-by: Tibor Benke <ihrwein@gmail.com>
2015-04-07std: Deny most warnings in doctestsAlex Crichton-8/+0
Allow a few specific ones but otherwise this helps ensure that our examples are squeaky clean! Closes #18199
2015-04-01Fallout in public-facing and semi-public-facing libsNiko Matsakis-1/+7
2015-03-31rollup merge of #23288: alexcrichton/issue-19470Alex Crichton-1/+1
This is a deprecated attribute that is slated for removal, and it also affects all implementors of the trait. This commit removes the attribute and fixes up implementors accordingly. The primary implementation which was lost was the ability to compare `&[T]` and `Vec<T>` (in that order). This change also modifies the `assert_eq!` macro to not consider both directions of equality, only the one given in the left/right forms to the macro. This modification is motivated due to the fact that `&[T] == Vec<T>` no longer compiles, causing hundreds of errors in unit tests in the standard library (and likely throughout the community as well). Closes #19470 [breaking-change]
2015-03-31rollup merge of #23908: aturon/stab-more-stragglersAlex Crichton-4/+2
* The `io::Seek` trait. * The `Iterator::{partition, unsip}` methods. * The `Vec::into_boxed_slice` method. * The `LinkedList::append` method. * The `{or_insert, or_insert_with` methods in the `Entry` APIs. r? @alexcrichton
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-1/+1
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.