about summary refs log tree commit diff
path: root/src/libstd/vec.rs
AgeCommit message (Collapse)AuthorLines
2014-01-28Rename CopyableVector to CloneableVectorVirgile Andreani-5/+5
2014-01-25Uppercase numeric constantsChris Wong-3/+3
The following are renamed: * `min_value` => `MIN` * `max_value` => `MAX` * `bits` => `BITS` * `bytes` => `BYTES` Fixes #10010.
2014-01-23Update flip() to be rev().Sean Chalmers-11/+11
Consensus leaned in favour of using rev instead of flip.
2014-01-23Rename Invert to Flip - Issue 10632Sean Chalmers-11/+11
Renamed the invert() function in iter.rs to flip(). Also renamed the Invert<T> type to Flip<T>. Some related code comments changed. Documentation that I could find has been updated, and all the instances I could locate where the function/type were called have been updated as well.
2014-01-22vec: make unsafe indexing functions higher-levelDaniel Micay-6/+6
2014-01-22Replace C types with Rust types in libstd, closes #7313Florian Hahn-5/+4
2014-01-21[std::vec] Rename .remove_opt() to .remove(), drop the old .remove() behaviorSimon Sapin-47/+13
2014-01-21[std::vec] Rename .shift_opt() to .shift(), drop the old .shift() behaviorSimon Sapin-23/+8
2014-01-21[std::vec] Rename .pop_opt() to .pop(), drop the old .pop() behaviorSimon Sapin-25/+6
2014-01-21[std::vec] Rename .last_opt() to .last(), drop the old .last() behaviorSimon Sapin-28/+5
2014-01-21[std::vec] Rename .head_opt() to .head(), drop the old .head() behaviorSimon Sapin-28/+5
2014-01-21[std::vec] Rename .get_opt() to .get()Simon Sapin-6/+6
2014-01-18Rename iterators for consistencyPalmer Cox-71/+71
Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over.
2014-01-17auto merge of #11585 : nikomatsakis/rust/issue-3511-rvalue-lifetimes, r=pcwaltonbors-0/+29
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way. r? @pcwalton
2014-01-15Remove FIXMEs and add licenseNiko Matsakis-1/+1
2014-01-15Issue #3511 - Rationalize temporary lifetimes.Niko Matsakis-1/+30
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way.
2014-01-15register snapshotsDaniel Micay-144/+0
2014-01-14add implementation of `Repr` for `~[T]`Daniel Micay-1/+1
2014-01-14remove reference counting headers from ~Daniel Micay-1/+98
Unique pointers and vectors currently contain a reference counting header when containing a managed pointer. This `{ ref_count, type_desc, prev, next }` header is not necessary and not a sensible foundation for tracing. It adds needless complexity to library code and is responsible for breakage in places where the branch has been left out. The `borrow_offset` field can now be removed from `TyDesc` along with the associated handling in the compiler. Closes #9510 Closes #11533
2014-01-12Removed remnants of `@mut` and `~mut` from comments and the type system.Eduard Burtescu-5/+2
2014-01-11Remove re-exports of std::io::stdio::{print, println} in the prelude.Brendan Zabarauskas-1/+1
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-08auto merge of #11370 : alexcrichton/rust/issue-10465, r=pwaltonbors-8/+8
Turned out to be a 2-line fix, but the compiler fallout was huge.
2014-01-07stdtest: Fix all leaked trait importsAlex Crichton-6/+4
2014-01-07std: Fill in all missing importsAlex Crichton-2/+4
Fallout from the previous commits
2014-01-07'borrowed pointer' -> 'reference'Brian Anderson-1/+1
2013-12-29Add method .as_mut_slice() to MutableVectorKevin Ballard-0/+6
This method is primarily intended to allow for converting a [T, ..N] to a &mut [T].
2013-12-27std: uniform modules titles for docLuca Bruno-1/+1
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-26auto merge of #11127 : huonw/rust/vec-docs, r=alexcrichtonbors-27/+115
2013-12-24std: Get stdtest all passing againAlex Crichton-1/+0
This commit brings the library up-to-date in order to get all tests passing again
2013-12-25std::vec: clarify & examplify more docs.Huon Wilson-16/+79
2013-12-25std::vec: correct .sort()'s doc-string and add someHuon Wilson-11/+36
examples/clarification to others.
2013-12-23std: Fix all code examplesAlex Crichton-5/+3
2013-12-22auto merge of #11082 : brson/rust/noat, r=alexcrichtonbors-21/+28
2013-12-22auto merge of #11064 : huonw/rust/vec-sort, r=alexcrichtonbors-1/+295
This uses quite a bit of unsafe code for speed and failure safety, and allocates `2*n` temporary storage. [Performance](https://gist.github.com/huonw/5547f2478380288a28c2): | n | new | priority_queue | quick3 | |-------:|---------:|---------------:|---------:| | 5 | 200 | 155 | 106 | | 100 | 6490 | 8750 | 5810 | | 10000 | 1300000 | 1790000 | 1060000 | | 100000 | 16700000 | 23600000 | 12700000 | | sorted | 520000 | 1380000 | 53900000 | | trend | 1310000 | 1690000 | 1100000 | (The times are in nanoseconds, having subtracted the set-up time (i.e. the `just_generate` bench target).) I imagine that there is still significant room for improvement, particularly because both priority_queue and quick3 are doing a static call via `Ord` or `TotalOrd` for the comparisons, while this is using a (boxed) closure. Also, this code does not `clone`, unlike `quick_sort3`; and is stable, unlike both of the others.
2013-12-22std::vec: make the sorting closure use `Ordering` rather than just beingHuon Wilson-54/+32
(implicitly) less_eq.
2013-12-21std: Remove some @-boxesBrian Anderson-21/+28
2013-12-20Update next() and size_hint() for MutSpliterIteratorPalmer Cox-11/+8
Update the next() method to just return self.v in the case that we've reached the last element that the iterator will yield. This produces equivalent behavior as before, but without the cost of updating the field. Update the size_hint() method to return a better hint now that #9629 is fixed.
2013-12-20Remove remainder field from MutChunkIterPalmer Cox-13/+10
This field is no longer necessary now that #9629 is fixed since we can just access the length of the remaining slice directly.
2013-12-21std::vec: add a sugary .sort() method for plain Ord sorting.Huon Wilson-6/+63
This moves the custom sorting to `.sort_by`.
2013-12-19auto merge of #11071 : huonw/rust/quiet-test, r=cmrbors-15/+2
2013-12-20std::vec: implement a stable merge sort, deferring to insertion sort forHuon Wilson-1/+260
very small runs. This uses a lot of unsafe code for speed, otherwise we would be having to sort by sorting lists of indices and then do a pile of swaps to put everything in the correct place. Fixes #9819.
2013-12-20std: silence warnings when compiling test.Huon Wilson-15/+2
2013-12-19auto merge of #11061 : huonw/rust/opt-unsafe-vec, r=alexcrichtonbors-48/+105
Before: ``` test vec::bench::random_inserts ... bench: 15025 ns/iter (+/- 409) test vec::bench::random_removes ... bench: 16063 ns/iter (+/- 276) ``` After: ``` test vec::bench::random_inserts ... bench: 5257 ns/iter (+/- 321) test vec::bench::random_removes ... bench: 4980 ns/iter (+/- 94) ```
2013-12-19std::vec: use some unsafe code to optimise `remove`.Huon Wilson-39/+74
Also, add `.remove_opt` and replace `.unshift` with `.remove(0)`. The code size reduction seem to compensate for not having the optimised special cases. This makes the included benchmark more than 3 times faster.
2013-12-19std::vec: replace .insert with a small amount of unsafe code.Huon Wilson-9/+31
This makes the included benchmark more than 3 times faster. Also, `.unshift(x)` is now faster as `.insert(0, x)` which can reuse the allocation if necessary.
2013-12-19std::vec: remove .as_muf_buf, replaced by .as_mut_ptr & .len.Huon Wilson-44/+20
2013-12-19std::vec: remove .as_imm_buf, replaced by .as_ptr & .len.Huon Wilson-38/+10
There's no need for the restrictions of a closure with the above methods.
2013-12-17auto merge of #10998 : thestinger/rust/iter, r=alexcrichtonbors-4/+2
2013-12-17auto merge of #10996 : huonw/rust/more-vec-raw, r=cmrbors-86/+64
The removal of the aliasing &mut[] and &[] from `shift_opt` also comes with its simplification. The above also allows the use of `copy_nonoverlapping_memory` in `[].copy_memory` (I did an audit of each use of `.copy_memory` and `std::vec::bytes::copy_memory`, and I believe none of them are called with arguments can ever alias). This changes requires that `unsafe` code using `copy_memory` **needs** to respect the aliasing rules of `&mut[]`.
2013-12-17std::vec: make init_elem nicer by doing fewer moves.Huon Wilson-5/+1