summary refs log tree commit diff
path: root/src/libcollections/btree/map.rs
AgeCommit message (Collapse)AuthorLines
2015-06-17More test fixes and fallout of stability changesAlex Crichton-4/+1
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-2/+2
2015-06-17std: Split the `std_misc` featureAlex Crichton-1/+1
2015-06-17collections: Split the `collections` featureAlex Crichton-2/+2
This commit also deprecates the `as_string` and `as_slice` free functions in the `string` and `vec` modules.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-2/+2
2015-06-08Implement RFC 839Johannes Oertel-0/+7
Closes #25976.
2015-05-20Auto merge of #25588 - bluss:doc-string-from, r=alexcrichtonbors-4/+1
Use stable code in doc examples (libcollections) Main task is to change from String::from_str to String::from in examples for String (the latter constructor is stable). While I'm at it, also remove redundant feature flags, fix some other instances of unstable code in examples (in examples for stable methods), and remove some use of usize in examples too.
2015-05-19collections: Clean up feature flags doc examplesUlrik Sverdrup-4/+1
2015-05-17Make debug builders take &mut self, add entries methodSteven Fackler-1/+1
[breaking-change]
2015-04-21rollup merge of #24541: alexcrichton/issue-24538Alex Crichton-32/+26
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-18Utilize if..let for get_mut doc-comment examplesCorey Farwell-3/+2
2015-04-17std: Add Default/IntoIterator/ToOwned to the preludeAlex Crichton-32/+26
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-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-2/+2
2015-04-10Fix some typosTibor Benke-1/+1
Signed-off-by: Tibor Benke <ihrwein@gmail.com>
2015-03-31Stabilize a few remaining stragglersAaron Turon-4/+2
* The `io::Seek` trait, and `SeekFrom` enum. * 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.
2015-03-28Fold collections debug implsSteven Fackler-5/+1
Also convert [T]'s Debug impl. The behavior of the alternate flag here's changing.
2015-03-28Update debug helpers and add list builderSteven Fackler-7/+4
The collections debug helpers no longer prefix output with the collection name, in line with the current conventions for Debug implementations. Implementations that want to preserve the current behavior can simply add a `try!(write!(fmt, "TypeName "));` at the beginning of the `fmt` method. [breaking-change]
2015-03-28Rollup merge of #23803 - richo:unused-braces, r=ManishearthManish Goregaokar-1/+1
Pretty much what it says on the tin.
2015-03-28cleanup: Remove unused braces in use statementsRicho Healey-1/+1
2015-03-27rollup merge of #23738: alexcrichton/snapshotsAlex Crichton-14/+0
Conflicts: src/libcollections/vec.rs
2015-03-27default => or_insert per RFCAlexis Beingessner-4/+4
2015-03-26update everything to use Entry defaultsAlexis-11/+2
2015-03-26entry API v3: replace Entry::get with Entry::default and Entry::default_withAlexis-1/+25
2015-03-26Register new snapshotsAlex Crichton-14/+0
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-0/+5
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23rollup merge of #23648: steveklabnik/rollupAlex Crichton-8/+8
- Successful merges: #22954, #23119, #23509, #23561, #23590, #23607, #23608, #23618, #23622, #23639, #23641 - Failed merges: #23401
2015-03-23rollup merge of #23604: apasel422/btreeAlex Crichton-0/+13
`btree_map::IntoIter` (and `btree_set::IntoIter`) remains, but it is a bit trickier.
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+5
2015-03-23Rollup merge of #23509 - aturon:stab-entry, r=GankroSteve Klabnik-8/+8
This commit marks as `#[stable]` the `Entry` types for the maps provided by `std`. The main reason these had been left unstable previously was uncertainty about an eventual trait design, but several plausible designs have been proposed that all work fine with the current type definitions. r? @Gankro
2015-03-23Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses ofNiko Matsakis-2/+2
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about how to use `[]`.
2015-03-23Adjust Index/IndexMut impls. For generic collections, we takeNiko Matsakis-0/+15
references. For collections whose keys are integers, we take both references and by-value.
2015-03-21implement `Clone` for `btree` iteratorsAndrew Paseltiner-0/+13
2015-03-20Future-proof indexing on maps: remove IndexMutAaron Turon-10/+1
This commit removes the `IndexMut` impls on `HashMap` and `BTreeMap`, in order to future-proof the API against the eventual inclusion of an `IndexSet` trait. Ideally, we would eventually be able to support: ```rust map[owned_key] = val; map[borrowed_key].mutating_method(arguments); &mut map[borrowed_key]; ``` but to keep the design space as unconstrained as possible, we do not currently want to support `IndexMut`, in case some other strategy will eventually be needed. Code currently using mutating index notation can use `get_mut` instead. [breaking-change] Closes #23448
2015-03-18Stabilize Entry typesAaron Turon-8/+8
This commit marks as `#[stable]` the `Entry` types for the maps provided by `std`. The main reason these had been left unstable previously was uncertainty about an eventual trait design, but several plausible designs have been proposed that all work fine with the current type definitions.
2015-03-16extract libcollections tests into libcollectionstestJorge Aparicio-306/+0
2015-03-16document undefined collection behavior with interior mutabilityAndrew Paseltiner-0/+4
closes #23327
2015-03-11Example -> ExamplesSteve Klabnik-1/+1
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-03Fixes to collections to accommodate arith-overflow changes.Felix S. Klock II-2/+2
* `collections::btree::node`: accommodate (transient) underflow. * `collections::btree::map`: avoid underflow during `fn next` for `BTreeMap::range` methods. * `collections::slice`: note that pnkfelix deliberately used `new_pos_wrapping` only once; the other cases of arithmetic do not over- nor underflow, which is a useful property to leave implicitly checked/documented via the remaining calls to `fn new_pos(..)`. * `collections::vec_deque` applied wrapping ops (somewhat blindly) to two implementation methods, and many tests. * `std::collections::hash::table` : Use `OverflowingOps` trait to track overflow during `calculate_offsets` and `calculate_allocation` functions.
2015-02-25Rollup merge of #22157 - tbu-:pr_debug_collections, r=alexcrichtonManish Goregaokar-1/+1
r? @Gankro
2015-02-24Change `Debug` implementation of `BTree*` as wellTobias Bucher-1/+1
2015-02-25Rollup merge of #22539 - oli-obk:style_nitpicks, r=ManishearthManish Goregaokar-4/+4
I tried to follow [the style guide][1] as much as possible. This is just from some random readings of the code, so no guarantees on completeness, even in the edited files. [1]: http://aturon.github.io/style/README.html
2015-02-24Use arrays instead of vectors in testsVadim Petrochenkov-2/+2
2015-02-24style nitpicksOliver Schneider-4/+4
2015-02-20Register new snapshotsAlex Crichton-10/+0
2015-02-18rollup merge of #22286: nikomatsakis/variance-4bAlex Crichton-4/+13
Conflicts: src/librustc/middle/infer/combine.rs src/librustc_typeck/check/wf.rs
2015-02-18rollup merge of #22210: aturon/stab-final-borrowAlex Crichton-7/+7
Conflicts: src/libcollections/btree/map.rs src/libcollections/str.rs src/libcollections/vec.rs src/libcore/borrow.rs src/libcore/hash/mod.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs
2015-02-18Stabilize std::borrowAaron Turon-7/+7
This commit stabilizes `std::borrow`, making the following modifications to catch up the API with language changes: * It renames `BorrowFrom` to `Borrow`, as was originally intended (but blocked for technical reasons), and reorders the parameters accordingly. * It moves the type parameter of `ToOwned` to an associated type. This is somewhat less flexible, in that each borrowed type must have a unique owned type, but leads to a significant simplification for `Cow`. Flexibility can be regained by using newtyped slices, which is advisable for other reasons anyway. * It removes the owned type parameter from `Cow`, making the type much less verbose. * Deprecates the `is_owned` and `is_borrowed` predicates in favor of direct matching. The above API changes are relatively minor; the basic functionality remains the same, and essentially the whole module is now marked `#[stable]`. [breaking-change]
2015-02-18rollup merge of #22491: Gankro/into_iterAlex Crichton-8/+8
Conflicts: src/libcollections/bit.rs src/libcollections/linked_list.rs src/libcollections/vec_deque.rs src/libstd/sys/common/wtf8.rs
2015-02-18make FromIterator use IntoIteratorAlexis-1/+1
This breaks all implementors of FromIterator, as they must now accept IntoIterator instead of Iterator. The fix for this is generally trivial (change the bound, and maybe call into_iter() on the argument to get the old argument). Users of FromIterator should be unaffected because Iterators are IntoIterator. [breaking-change]