about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2015-05-19fmt.rs: add note about lack of padding support for some typesParker Moore-0/+4
2015-05-19Auto merge of #25548 - sfackler:debug-builders-by-ref, r=alexcrichtonbors-3/+3
Based on feedback from https://internals.rust-lang.org/t/final-comment-period-for-debug-builders-stabilization/2007/2
2015-05-19collections: Clean up feature flags doc examplesUlrik Sverdrup-33/+7
2015-05-19collections: Avoid unstable code in examples for VecUlrik Sverdrup-8/+4
2015-05-19collections: Avoid unstable code in examples for StringUlrik Sverdrup-21/+9
Prefer String::from over from_str; String::from_str is unstable while String::from is stable. Promote the latter by using it in examples. Simply migrating unstable function to the closest alternative.
2015-05-18Auto merge of #25230 - rayglover:patch-bitset, r=Gankrobors-74/+83
Some modest running-time improvements to `std::collections::BitSet` on bit-sets of varying set-membership densities. This is work originally from [here](https://github.com/rayglover/alt_collections). (Benchmarks copied below) ``` std::collections::BitSet / alt_collections::BitSet copy_dense ... 3.08x copy_sparse ... 4.22x count_dense ... 11.01x count_sparse ... 8.11x from_bytes ... 1.47x intersect_dense ... 6.54x intersect_sparse ... 4.37x union_dense ... 5.53x union_sparse ... 5.60x ``` The exception is `from_bytes`, which I've left unaltered since the optimization is rather obscure. Compiling with the cpu feature `popcnt` gave a further ~10% improvement on my machine, but this wasn't factored in to the benchmarks above. Similar improvements could be made to `BitVec`, although that would probably require more substantial changes. criticism welcome!
2015-05-17Make debug builders take &mut self, add entries methodSteven Fackler-3/+3
[breaking-change]
2015-05-16Fixed reserve_exact exampleMário Feroldi-1/+1
The same example for ``reverse`` were in the ``reserve_exact``'s example.
2015-05-16Auto merge of #25434 - dotdash:gep, r=alexcrichtonbors-0/+138
Using regular pointer arithmetic to iterate collections of zero-sized types doesn't work, because we'd get the same pointer all the time. Our current solution is to convert the pointer to an integer, add an offset and then convert back, but this inhibits certain optimizations. What we should do instead is to convert the pointer to one that points to an i8\*, and then use a LLVM GEP instructions without the inbounds flag to perform the pointer arithmetic. This allows to generate pointers that point outside allocated objects without causing UB (as long as you don't dereference them), and it wraps around using two's complement, i.e. it behaves exactly like the wrapping_* operations we're currently using, with the added benefit of LLVM being able to better optimize the resulting IR.
2015-05-16Auto merge of #25462 - alexcrichton:favicon-https, r=nrcbors-1/+1
Helps prevent mixed content warnings if accessing docs over HTTPS. Closes #25459
2015-05-16fix to size_hint(); documentation for bit-twiddle;ray glover-15/+22
2015-05-15libs: Move favicon URLs to HTTPSAlex Crichton-1/+1
Helps prevent mixed content warnings if accessing docs over HTTPS. Closes #25459
2015-05-16Allow `?Sized` types in `Rc`’s impls of {Partial,}{Ord,Eq} and BorrowP1start-0/+6
2015-05-15Allow for better optimizations of iterators for zero-sized typesBjörn Steinbrink-0/+138
Using regular pointer arithmetic to iterate collections of zero-sized types doesn't work, because we'd get the same pointer all the time. Our current solution is to convert the pointer to an integer, add an offset and then convert back, but this inhibits certain optimizations. What we should do instead is to convert the pointer to one that points to an i8*, and then use a LLVM GEP instructions without the inbounds flag to perform the pointer arithmetic. This allows to generate pointers that point outside allocated objects without causing UB (as long as you don't dereference them), and it wraps around using two's complement, i.e. it behaves exactly like the wrapping_* operations we're currently using, with the added benefit of LLVM being able to better optimize the resulting IR.
2015-05-14Add #[inline] to Borrow<str>::borrow for String.Jan Bujak-0/+1
2015-05-13Small cleanup to vec docsSteve Klabnik-10/+12
Add the repeating form of the vec macro Remove unneeded literal annotations. Use more conventional variable names.
2015-05-12TRPL: Borrow and AsRefSteve Klabnik-0/+5
These two traits are commonly confused. As such, explain the difference. Fixes #24163
2015-05-11Rollup merge of #25288 - DrKwint:master, r=alexcrichtonSteve Klabnik-3/+3
The functions BitSet::{iter,union,symmetric_difference} each had docs that claimed u32s were output when their actual output each end up being usizes. r? @steveklabnik
2015-05-11Auto merge of #25301 - jooert:vec_map_fix_split_off, r=Gankrobors-1/+1
We don't need to copy any elements if `at` is behind the last element in the map. The last element is at index `self.v.len() - 1`, so we should not copy if `at` is greater **or equals** `self.v.len()`. r? @Gankro
2015-05-11Rollup merge of #25290 - bluss:docfixes, r=steveklabnikManish Goregaokar-2/+3
Several Minor API / Reference Documentation Fixes - Fix a few small errors in the reference. - Fix paper cuts in the API docs. Fixes #24882 Fixes #25233 Fixes #25250
2015-05-11Minor optimization for `VecMap::split_off`Johannes Oertel-1/+1
We don't need to copy any elements if `at` is behind the last element in the map. The last element is at index `self.v.len() - 1`, so we should not copy if `at` is greater or equals `self.v.len()`.
2015-05-11docs: Update SliceConcatExt docs for assoc typesUlrik Sverdrup-2/+3
2015-05-11Auto merge of #24934 - jooert:bitset-append-split_off, r=Gankrobors-0/+83
cc #19986
2015-05-10Update BitSet docs to correct typesPaul Quint-3/+3
Update BitSet docs to correct type in one more spot removed accidental file
2015-05-10Rollup merge of #25158 - koute:master, r=alexcrichtonSteve Klabnik-0/+1
I was profiling my code again and this time AsRef<str> for String was eating up a considerable chunk of my runtime; adding the inline annotation made the program run almost twice as fast! While I was at it I also added the annotation to other implementations of AsRef as well as AsMut.
2015-05-10Implement `append` and `split_off` for BitSet (RFC 509)Johannes Oertel-0/+83
2015-05-10Add #[inline] to AsRef<str>::as_ref for String and str.Jan Bujak-0/+1
2015-05-09Rollup merge of #25227 - jooert:bitvec-doc-fix, r=alexcrichtonManish Goregaokar-0/+4
I forgot this in #24890.
2015-05-09Auto merge of #25162 - seanmonstar:asref-bytes, r=alexcrichtonbors-12/+18
r? @aturon
2015-05-08collections: change bounds of SliceConcatExt implementations to use Borrow ↵Sean McArthur-12/+10
instead of AsRef
2015-05-08collections: impl AsRef<[u8]> for StringSean McArthur-0/+8
2015-05-09Perf improvements to `collections::BitSet`.ray glover-75/+77
2015-05-09Document panic behaviour of BitVec::split_offJohannes Oertel-0/+4
2015-05-08Auto merge of #25187 - alexcrichton:mem-forget-safe, r=brsonbors-2/+2
This commit is an implementation of [RFC 1066][rfc] where the conclusion was that leaking a value is a safe operation in Rust code, so updating the signature of this function follows suit. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1066-safe-mem-forget.md Closes #25186
2015-05-07std: Mark `mem::forget` as a safe functionAlex Crichton-2/+2
This commit is an implementation of [RFC 1066][rfc] where the conclusion was that leaking a value is a safe operation in Rust code, so updating the signature of this function follows suit. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1066-safe-mem-forget.md Closes #25186
2015-05-07Auto merge of #25157 - alexcrichton:remove-vec-add, r=aturonbors-12/+1
Ideally this trait implementation would be unstable, requiring crates to opt-in if they would like the functionality, but that's not currently how stability works so the implementation needs to be removed entirely. This may come back at a future date, but for now the conservative option is to remove it. [breaking-change]
2015-05-07Auto merge of #24890 - jooert:bitvec-append-split_off, r=alexcrichtonbors-0/+101
cc #19986 r? @Gankro
2015-05-06std: Remove addition on vectors for nowAlex Crichton-12/+1
Ideally this trait implementation would be unstable, requiring crates to opt-in if they would like the functionality, but that's not currently how stability works so the implementation needs to be removed entirely. This may come back at a future date, but for now the conservative option is to remove it. [breaking-change]
2015-05-06Auto merge of #25120 - bluss:sliceconcatext, r=alexcrichtonbors-6/+14
collections: Convert SliceConcatExt to use associated types Coherence now allows this, we have `SliceConcatExt<T> for [V] where T: Sized + Clone` and` SliceConcatExt<str> for [S]`, these don't conflict because str is never Sized.
2015-05-06Implement append and split_off for BitVec (RFC 509)Johannes Oertel-0/+101
2015-05-06Auto merge of #24879 - Stebalien:vec_deque, r=alexcrichtonbors-0/+36
According to rust-lang/rfcs#235, `VecDeque` should have this method (`VecDeque` was called `RingBuf` at the time) but it was never implemented. I marked this stable since "1.0.0" because it's stable in `Vec`.
2015-05-05collections: Convert SliceConcatExt to use associated typesUlrik Sverdrup-6/+14
Coherence now allows this, we have SliceConcatExt<T> for [V] where T: Sized + Clone and SliceConcatExt<str> for [S], these don't conflict because str is never Sized.
2015-05-05Auto merge of #25111 - Manishearth:rollup, r=Manishearthbors-7/+15
r? @Manishearth
2015-05-05Rollup merge of #25100 - jbcrail:fix-spelling-errors, r=steveklabnikManish Goregaokar-3/+3
I corrected several spelling errors in the external documentation.
2015-05-05Rollup merge of #25087 - nham:improve_vec_docs, r=GankroManish Goregaokar-4/+12
This commit does two things: it adds an example for indexing vectors, and it changes the \"Examples\" section to use full sentences. This change was spurred by someone in the #rust IRC channel asking if there was a `.set()` method for changing the `i`-th value of a vector (they had missed that `Vec` implements `IndexMut`, which is easy to do if you're not aware of that trait).
2015-05-04Implement retain for vec_dequeSteven Allen-0/+36
2015-05-05Auto merge of #25095 - huonw:faster-bitvec, r=alexcrichtonbors-6/+4
This makes the `bit::vec::bench::bench_bit_vec_big_union` benchmark go from `774 ns/iter (+/- 190)` to `602 ns/iter (+/- 5)`. (There's room for more work here too: if one can guarantee 128-bit alignment for the vector, the compiler actually optimises `union`, `intersection` etc. to SIMD instructions, which end up being ~5x faster that the original version, and 4x faster than the optimised version in this patch.)
2015-05-04Fix spelling errors in documentation.Joseph Crail-3/+3
2015-05-04Make `BitVec::process` faster (branch free).Huon Wilson-6/+4
This makes the `bit::vec::bench::bench_bit_vec_big_union` benchmark go from `774 ns/iter (+/- 190)` to `602 ns/iter (+/- 5)`. (There's room for more work here too: if one can guarantee 128-bit alignment for the vector, the compiler actually optimises `union`, `intersection` etc. to SIMD instructions, which end up being ~5x faster that the original version, and 4x faster than the optimised version in this patch.)
2015-05-03Improve std::vec module documentation.Nick Hamann-4/+12
This changes the std::vec module docs to use full sentences. It also adds an example for indexing vectors.