about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2014-12-15auto merge of #19448 : japaric/rust/binops-by-value, r=nikomatsakisbors-9/+372
- The following operator traits now take their arguments by value: `Add`, `Sub`, `Mul`, `Div`, `Rem`, `BitAnd`, `BitOr`, `BitXor`, `Shl`, `Shr`. This breaks all existing implementations of these traits. - The binary operation `a OP b` now "desugars" to `OpTrait::op_method(a, b)` and consumes both arguments. - `String` and `Vec` addition have been changed to reuse the LHS owned value, and to avoid internal cloning. Only the following asymmetric operations are available: `String + &str` and `Vec<T> + &[T]`, which are now a short-hand for the "append" operation. [breaking-change] --- This passes `make check` locally. I haven't touch the unary operators in this PR, but converting them to by value should be very similar to this PR. I can work on them after this gets the thumbs up. @nikomatsakis r? the compiler changes @aturon r? the library changes. I think the only controversial bit is the semantic change of the `Vec`/`String` `Add` implementation. cc #19148
2014-12-15Remove internal uses of `marker::NoCopy`Jorge Aparicio-6/+0
2014-12-15Remove all shadowed lifetimes.Niko Matsakis-3/+3
2014-12-15rollup merge of #19802: jbranchaud/add-btreeset-new-doctestBrian Anderson-0/+8
2014-12-15rollup merge of #19771: jbranchaud/add-btreeset-iter-doctestsBrian Anderson-0/+26
2014-12-15rollup merge of #19710: steveklabnik/gh15449Brian Anderson-2/+2
Fixes #15499.
2014-12-15Standardize some usages of "which" in docstringsAndrew Wagner-1/+1
In US english, "that" is used in restrictive clauses in place of "which", and often affects the meaning of sentences. In UK english and many dialects, no distinction is made. While Rust devs want to avoid unproductive pedanticism, it is worth at least being uniform in documentation such as: http://doc.rust-lang.org/std/iter/index.html and also in cases where correct usage of US english clarifies the sentence.
2014-12-14std: Collapse SlicePrelude traitsAlex Crichton-29/+695
This commit collapses the various prelude traits for slices into just one trait: * SlicePrelude/SliceAllocPrelude => SliceExt * CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt * OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt * PartialEqSlicePrelude => PartialEqSliceExt
2014-12-14Mostly rote conversion of `proc()` to `move||` (and occasionally `Thunk::new`)Niko Matsakis-1/+1
2014-12-13Change `VecMap`'s iterators to use wrapper structs instead of typedefs.Chase Southwood-14/+45
Using a type alias for iterator implementations is fragile since this exposes the implementation to users of the iterator, and any changes could break existing code. This commit changes the iterators of `VecMap` to use proper new types, rather than type aliases. However, since it is fair-game to treat a type-alias as the aliased type, this is a: [breaking-change].
2014-12-13libcollections: convert `BTreeSet` binops to by valueJorge Aparicio-0/+96
2014-12-13libcollections: convert `TreeSet` binops to by valueJorge Aparicio-4/+100
2014-12-13libcollections: convert `TrieSet` binops to by valueJorge Aparicio-4/+100
2014-12-13libcollections: add commutative version of `Vec`/`String` additionJorge Aparicio-0/+17
2014-12-13libcollections: fix unit testsJorge Aparicio-1/+1
2014-12-13libcollections: make `EnumSet` binops by valueJorge Aparicio-0/+36
2014-12-13libcollections: String + &strJorge Aparicio-0/+10
2014-12-13libcollections: Vec<T> + &[T]Jorge Aparicio-0/+12
2014-12-13libcollections: use tuple indexingJorge Aparicio-3/+3
2014-12-13libcollections: use unboxed closuresJorge Aparicio-12/+32
2014-12-13libcollections: use unboxed closures in `VecMap` methodsJorge Aparicio-7/+6
2014-12-13libcollections: use unboxed closures in `[Clone]SliceAllocPrelude` methodsJorge Aparicio-6/+7
2014-12-13libcollections: use unboxed closures in `DList` methodsJorge Aparicio-11/+9
2014-12-13libcollections: use unboxed closures in `Vec` methodsJorge Aparicio-6/+6
2014-12-13libcollections: use unboxed closures in `Bitv` methodsJorge Aparicio-8/+16
2014-12-13libcollections: use unboxed closures in `TreeMap` methodsJorge Aparicio-6/+16
2014-12-13libcollections: fix fallout in unit testsJorge Aparicio-12/+12
2014-12-13libcollections: fix unit testsJorge Aparicio-27/+54
2014-12-13libcollections: fix falloutJorge Aparicio-5/+10
2014-12-13libcollections: fix falloutJorge Aparicio-22/+43
2014-12-13auto merge of #19685 : jbranchaud/rust/add-btreemap-iter-doctests, r=Gankrobors-0/+33
2014-12-13auto merge of #19671 : tbu-/rust/pr_doc_removetraitrefs, r=Gankrobors-9/+8
This specifically means: - `Deque` - `Map` - `Set`
2014-12-12Make BTree's Handle system more generic and more powerful, removing some ↵Jonathan S-298/+259
runtine checks in favor of newly gained static safety
2014-12-12Add a doctest for BTreeSet::new.jbranchaud-0/+8
2014-12-12auto merge of #19569 : murphm8/rust/ring_buf_insert, r=Gankrobors-1/+267
This is a first pass at insert on RingBuf. I tried to keep it as simple as possible. I'm not sure of the performance implications of doing one copy vs. copying multiple times but moving a smaller amount of memory. I chose to stick with one copy, even if the amount of memory I have to move is larger. I believe this is part of #18424 @Gankro mentioned this was missing.
2014-12-12auto merge of #18028 : gereeter/rust/slimmer-btree-node, r=Gankrobors-493/+1476
...ated buffer. Before: test btree::map::bench::find_rand_100 ... bench: 29 ns/iter (+/- 2) test btree::map::bench::find_rand_10_000 ... bench: 83 ns/iter (+/- 6) test btree::map::bench::find_seq_100 ... bench: 30 ns/iter (+/- 1) test btree::map::bench::find_seq_10_000 ... bench: 50 ns/iter (+/- 3) test btree::map::bench::insert_rand_100 ... bench: 186 ns/iter (+/- 30) test btree::map::bench::insert_rand_10_000 ... bench: 377 ns/iter (+/- 8) test btree::map::bench::insert_seq_100 ... bench: 299 ns/iter (+/- 10) test btree::map::bench::insert_seq_10_000 ... bench: 368 ns/iter (+/- 12) test btree::map::bench::iter_1000 ... bench: 20956 ns/iter (+/- 479) test btree::map::bench::iter_100000 ... bench: 2060899 ns/iter (+/- 44325) test btree::map::bench::iter_20 ... bench: 560 ns/iter (+/- 63) After: test btree::map::bench::find_rand_100 ... bench: 28 ns/iter (+/- 2) test btree::map::bench::find_rand_10_000 ... bench: 74 ns/iter (+/- 3) test btree::map::bench::find_seq_100 ... bench: 31 ns/iter (+/- 0) test btree::map::bench::find_seq_10_000 ... bench: 46 ns/iter (+/- 0) test btree::map::bench::insert_rand_100 ... bench: 141 ns/iter (+/- 1) test btree::map::bench::insert_rand_10_000 ... bench: 273 ns/iter (+/- 12) test btree::map::bench::insert_seq_100 ... bench: 255 ns/iter (+/- 17) test btree::map::bench::insert_seq_10_000 ... bench: 340 ns/iter (+/- 3) test btree::map::bench::iter_1000 ... bench: 21193 ns/iter (+/- 1958) test btree::map::bench::iter_100000 ... bench: 2203599 ns/iter (+/- 100491) test btree::map::bench::iter_20 ... bench: 614 ns/iter (+/- 110) This code could probably be a fair bit cleaner, but it works. Part of #18009.
2014-12-12Slimmify BTree by replacing its internal Node type, which previously…held ↵Jonathan S-493/+1476
three separately allocated `Vec`s, with a manually allocated buffer. Additionally, restructure the node and stack interfaces to be safer and require fewer bounds checks. Before: test btree::map::bench::find_rand_100 ... bench: 35 ns/iter (+/- 2) test btree::map::bench::find_rand_10_000 ... bench: 88 ns/iter (+/- 3) test btree::map::bench::find_seq_100 ... bench: 36 ns/iter (+/- 1) test btree::map::bench::find_seq_10_000 ... bench: 62 ns/iter (+/- 0) test btree::map::bench::insert_rand_100 ... bench: 157 ns/iter (+/- 8) test btree::map::bench::insert_rand_10_000 ... bench: 413 ns/iter (+/- 8) test btree::map::bench::insert_seq_100 ... bench: 272 ns/iter (+/- 10) test btree::map::bench::insert_seq_10_000 ... bench: 369 ns/iter (+/- 19) test btree::map::bench::iter_1000 ... bench: 19049 ns/iter (+/- 740) test btree::map::bench::iter_100000 ... bench: 1916737 ns/iter (+/- 102250) test btree::map::bench::iter_20 ... bench: 424 ns/iter (+/- 40) After: test btree::map::bench::find_rand_100 ... bench: 9 ns/iter (+/- 1) test btree::map::bench::find_rand_10_000 ... bench: 8 ns/iter (+/- 0) test btree::map::bench::find_seq_100 ... bench: 7 ns/iter (+/- 0) test btree::map::bench::find_seq_10_000 ... bench: 8 ns/iter (+/- 0) test btree::map::bench::insert_rand_100 ... bench: 136 ns/iter (+/- 5) test btree::map::bench::insert_rand_10_000 ... bench: 380 ns/iter (+/- 34) test btree::map::bench::insert_seq_100 ... bench: 255 ns/iter (+/- 8) test btree::map::bench::insert_seq_10_000 ... bench: 364 ns/iter (+/- 10) test btree::map::bench::iter_1000 ... bench: 19112 ns/iter (+/- 837) test btree::map::bench::iter_100000 ... bench: 1911961 ns/iter (+/- 33069) test btree::map::bench::iter_20 ... bench: 453 ns/iter (+/- 37)
2014-12-12Add doctests for `iter` and `into_iter` for BTreeSet.jbranchaud-0/+26
2014-12-11Implement insert for RingBufMatt Murphy-1/+267
2014-12-12auto merge of #19514 : jbranchaud/rust/add-btree-set-bitor, r=Gankrobors-1/+84
I am trying to add an implementation of `bitor` for `BTreeSet`. I think I am most of the way there, but I am going to need some guidance to take it all the way. When I run `make check`, I get: ``` error: cannot move out of dereference of `&`-pointer self.union(_rhs).map(|&i| i).collect::<BTreeSet<T>>() ^~ ``` I'd appreciate any nudges in the right direction. If I can figure this one out, I am sure I will be able to implement `bitand`, `bitxor`, and `sub` as well. /cc @Gankro --- **Update** I have added implementations for `BitOr`, `BitAnd`, `BitXor`, and `Sub` for `BTreeSet`.
2014-12-11Add an implementation of the BitOps for BTreeSets.jbranchaud-1/+84
Add initial attempt at implementing BitOr for BTreeSet. Update the implementation of the bitor operator for BTreeSets. `make check` ran fine through this. Add implementations for BitAnd, BitXor, and Sub as well. Remove the FIXME comment and add unstable flags. Add doctests for the bitop functions.
2014-12-11auto merge of #19672 : alexcrichton/rust/snapshots, r=brsonbors-308/+432
These snapshots were generated on the 10.7 bot which should be the first step in fixing #19643
2014-12-11Register new snapshotsAlex Crichton-308/+432
2014-12-11auto merge of #19377 : tbu-/rust/pr_mapinplace_fixzerosized_test, r=sfacklerbors-0/+29
2014-12-10Fix inappropriate ## headingsSteve Klabnik-2/+2
Fixes #15499.
2014-12-10auto merge of #19663 : tbu-/rust/pr_fix_vecmap, r=Gankrobors-35/+53
- Introduce a named type for the return type of `VecMap::move_iter` - Rename all type parameters to `V` for "Value". - Remove unnecessary call to an `Option::unwrap`, use pattern matching instead. - Remove incorrect `Hash` implementation which took the `VecMap`'s capacity into account. This is a [breaking-change], however whoever used the `Hash` implementation relied on an incorrect implementation.
2014-12-10auto merge of #19655 : jbranchaud/rust/change-example-to-examples, ↵bors-283/+286
r=steveklabnik @steveklabnik I got a start on this.
2014-12-10Remove references to traits that no longer existTobias Bucher-9/+8
This specifically means: - `Deque` - `Map` - `Set`
2014-12-10auto merge of #19628 : jbranchaud/rust/add-string-as-string-doctest, ↵bors-0/+13
r=steveklabnik
2014-12-09Add doctests for `iter_mut` and `into_iter` of BTreeMap.jbranchaud-0/+33
Add spacing as dictated by standard rust code style.