about summary refs log tree commit diff
path: root/src/libstd/collections
AgeCommit message (Collapse)AuthorLines
2014-08-29Register new snapshotsAlex Crichton-18/+0
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-2/+20
2014-08-13core: Rename ImmutableEqSlice to ImmutablePartialEqSliceBrian Anderson-1/+1
This is in the prelude and won't break much code. [breaking-change]
2014-08-13std: Rename various slice traits for consistencyBrian Anderson-1/+1
ImmutableVector -> ImmutableSlice ImmutableEqVector -> ImmutableEqSlice ImmutableOrdVector -> ImmutableOrdSlice MutableVector -> MutableSlice MutableVectorAllocating -> MutableSliceAllocating MutableCloneableVector -> MutableCloneableSlice MutableOrdVector -> MutableOrdSlice These are all in the prelude so most code will not break. [breaking-change]
2014-08-12auto merge of #16195 : P1start/rust/more-index, r=aturonbors-6/+48
Implement `Index` for `RingBuf`, `HashMap`, `TreeMap`, `SmallIntMap`, and `TrieMap`. If there’s anything that I missed or should be removed, let me know.
2014-08-12Implement Index for HashMapP1start-6/+48
This also deprecates HashMap::get. Use indexing instead.
2014-08-01Fix misspelled comments.Joseph Crail-1/+1
2014-07-30Library changes for RFC #43Cameron Zwarich-1/+2
2014-07-28doc: reduce overlong sentenceTshepang Lekhonkhobe-1/+1
2014-07-27doc: Correctly onclose code blocks in HashSetJonas Hietala-0/+3
2014-07-26auto merge of #15941 : treeman/rust/doc-lru, r=alexcrichtonbors-0/+85
2014-07-24Cleanup HashMap documentation.Jonas Hietala-53/+68
Link to mentioned methods. Use `# Failure` tags to describe failure. Make `pop_equiv`, `find_equiv` and `get_copy` standalone.
2014-07-24Cleanup LruCache doc.Jonas Hietala-9/+8
2014-07-24Documentation examples for LruCache.Jonas Hietala-0/+86
2014-07-24Remove explicit rust code specifier. Unhide use HashMap.Jonas Hietala-56/+56
2014-07-24Fill in example code for HashMap.Jonas Hietala-19/+293
Add an example showing how to use the map with a custom type. Fill in examples for methods in the hashmap file without ones. Also move pop_equiv next to related public methods, to not create a duplicate trait implementation in the docs.
2014-07-23Just land alreadyBrian Anderson-1/+1
2014-07-23collections: Move push/pop to MutableSeqBrian Anderson-1/+1
Implement for Vec, DList, RingBuf. Add MutableSeq to the prelude. Since the collections traits are in the prelude most consumers of these methods will continue to work without change. [breaking-change]
2014-07-22auto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichtonbors-0/+2
2014-07-21Add a ton of ignore-lexer-testCorey Richardson-0/+2
2014-07-18Remove examples from trait implementations. Unhide imports.Jonas Hietala-154/+18
2014-07-18Fill in documentation for HashSet.Jonas Hietala-37/+267
Example how to use the set with a custom type. Fill in examples for the missing methods.
2014-07-16Extend HashSet documentation.Jonas Hietala-4/+159
Add main example and simple examples for the methods.
2014-07-13Stabilization for `owned` (now `boxed`) and `cell`Aaron Turon-1/+1
This PR is the outcome of the library stabilization meeting for the `liballoc::owned` and `libcore::cell` modules. Aside from the stability attributes, there are a few breaking changes: * The `owned` modules is now named `boxed`, to better represent its contents. (`box` was unavailable, since it's a keyword.) This will help avoid the misconception that `Box` plays a special role wrt ownership. * The `AnyOwnExt` extension trait is renamed to `BoxAny`, and its `move` method is renamed to `downcast`, in both cases to improve clarity. * The recently-added `AnySendOwnExt` extension trait is removed; it was not being used and is unnecessary. [breaking-change]
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-7/+7
[breaking-change]
2014-07-04librustc: Remove the `&LIFETIME EXPR` production from the language.Patrick Walton-6/+3
This was parsed by the parser but completely ignored; not even stored in the AST! This breaks code that looks like: static X: &'static [u8] = &'static [1, 2, 3]; Change this code to the shorter: static X: &'static [u8] = &[1, 2, 3]; Closes #15312. [breaking-change]
2014-07-02auto merge of #15257 : erickt/rust/hashmap, r=alexcrichtonbors-15/+18
While `HashMap::new` and `HashMap::with_capacity` were being initialized with a random `SipHasher`, it turns out that `HashMap::from_iter` was just using the default instance of `SipHasher`, which wasn't randomized. This closes that bug, and also inlines some important methods.
2014-06-30libstd: set baseline stability levels.Aaron Turon-0/+2
Earlier commits have established a baseline of `experimental` stability for all crates under the facade (so their contents are considered experimental within libstd). Since `experimental` is `allow` by default, we should use the same baseline stability for libstd itself. This commit adds `experimental` tags to all of the modules defined in `std`, and `unstable` to `std` itself.
2014-06-30std: micro optimize Hash{Map,Set}::{new,with_capacity}Erick Tryzelaar-0/+8
2014-06-30std: make sure HashMap from_iter uses random initialization by defaultErick Tryzelaar-15/+10
It turns out that HashMap's from_iter implementation was being initialized without the sip keys being randomized. This adds a custom default hasher that should avoid this potential vulnerability.
2014-06-28Rename all raw pointers as necessaryAlex Crichton-3/+3
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-70/+70
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-15Register new snapshotsAlex Crichton-44/+0
2014-06-11std: Remove i18n/l10n from format!Alex Crichton-0/+44
* The select/plural methods from format strings are removed * The # character no longer needs to be escaped * The \-based escapes have been removed * '{{' is now an escape for '{' * '}}' is now an escape for '}' Closes #14810 [breaking-change]
2014-06-10auto merge of #14696 : jakub-/rust/dead-struct-fields, r=alexcrichtonbors-3/+2
This uncovered some dead code, most notably in middle/liveness.rs, which I think suggests there must be something fishy with that part of the code. The #[allow(dead_code)] annotations on some of the fields I am not super happy about but as I understand, marker type may disappear at some point.
2014-06-09core: Move the collections traits to libcollectionsAlex Crichton-7/+8
This commit moves Mutable, Map, MutableMap, Set, and MutableSet from `core::collections` to the `collections` crate at the top-level. Additionally, this removes the `deque` module and moves the `Deque` trait to only being available at the top-level of the collections crate. All functionality continues to be reexported through `std::collections`. [breaking-change]
2014-06-08core: Rename `container` mod to `collections`. Closes #12543Brian Anderson-3/+3
Also renames the `Container` trait to `Collection`. [breaking-change]
2014-06-08Remove the dead code identified by the new lintJakub Wieczorek-3/+2
2014-06-06Implement Eq for HashSet and HashMapSteven Fackler-3/+7
Also fix documentation references to PartialEq.
2014-06-05Fallout from the libcollections movementAlex Crichton-14/+25
2014-06-05std: Recreate a `collections` moduleAlex Crichton-0/+2880
As with the previous commit with `librand`, this commit shuffles around some `collections` code. The new state of the world is similar to that of librand: * The libcollections crate now only depends on libcore and liballoc. * The standard library has a new module, `std::collections`. All functionality of libcollections is reexported through this module. I would like to stress that this change is purely cosmetic. There are very few alterations to these primitives. There are a number of notable points about the new organization: * std::{str, slice, string, vec} all moved to libcollections. There is no reason that these primitives shouldn't be necessarily usable in a freestanding context that has allocation. These are all reexported in their usual places in the standard library. * The `hashmap`, and transitively the `lru_cache`, modules no longer reside in `libcollections`, but rather in libstd. The reason for this is because the `HashMap::new` contructor requires access to the OSRng for initially seeding the hash map. Beyond this requirement, there is no reason that the hashmap could not move to libcollections. I do, however, have a plan to move the hash map to the collections module. The `HashMap::new` function could be altered to require that the `H` hasher parameter ascribe to the `Default` trait, allowing the entire `hashmap` module to live in libcollections. The key idea would be that the default hasher would be different in libstd. Something along the lines of: // src/libstd/collections/mod.rs pub type HashMap<K, V, H = RandomizedSipHasher> = core_collections::HashMap<K, V, H>; This is not possible today because you cannot invoke static methods through type aliases. If we modified the compiler, however, to allow invocation of static methods through type aliases, then this type definition would essentially be switching the default hasher from `SipHasher` in libcollections to a libstd-defined `RandomizedSipHasher` type. This type's `Default` implementation would randomly seed the `SipHasher` instance, and otherwise perform the same as `SipHasher`. This future state doesn't seem incredibly far off, but until that time comes, the hashmap module will live in libstd to not compromise on functionality. * In preparation for the hashmap moving to libcollections, the `hash` module has moved from libstd to libcollections. A previously snapshotted commit enables a distinct `Writer` trait to live in the `hash` module which `Hash` implementations are now parameterized over. Due to using a custom trait, the `SipHasher` implementation has lost its specialized methods for writing integers. These can be re-added backwards-compatibly in the future via default methods if necessary, but the FNV hashing should satisfy much of the need for speedier hashing. A list of breaking changes: * HashMap::{get, get_mut} no longer fails with the key formatted into the error message with `{:?}`, instead, a generic message is printed. With backtraces, it should still be not-too-hard to track down errors. * The HashMap, HashSet, and LruCache types are now available through std::collections instead of the collections crate. * Manual implementations of hash should be parameterized over `hash::Writer` instead of just `Writer`. [breaking-change]