| Age | Commit message (Collapse) | Author | Lines |
|
- 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
|
|
|
|
|
|
|
|
|
|
Fixes #15499.
|
|
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.
|
|
This commit collapses the various prelude traits for slices into just one trait:
* SlicePrelude/SliceAllocPrelude => SliceExt
* CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt
* OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt
* PartialEqSlicePrelude => PartialEqSliceExt
|
|
|
|
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].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This specifically means:
- `Deque`
- `Map`
- `Set`
|
|
runtine checks in favor of newly gained static safety
|
|
|
|
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.
|
|
...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.
|
|
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)
|
|
|
|
|
|
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`.
|
|
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.
|
|
These snapshots were generated on the 10.7 bot which should be the first step in fixing #19643
|
|
|
|
|
|
Fixes #15499.
|
|
- 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.
|
|
r=steveklabnik
@steveklabnik I got a start on this.
|
|
This specifically means:
- `Deque`
- `Map`
- `Set`
|
|
r=steveklabnik
|
|
Add spacing as dictated by standard rust code style.
|