summary refs log tree commit diff
path: root/src/libstd/at_vec.rs
AgeCommit message (Collapse)AuthorLines
2013-09-17std::at_vec: Fix segfault on overflow when resizing ~[@T]blake2-ppc-5/+8
Easy to reproduce: let mut v = ~[@1]; v.resize(-1); // success a.k.a silent failure v.push(@2); // segfault
2013-09-12std: rename Option::unwrap_or_default() to unwrap_or()Erick Tryzelaar-1/+1
2013-09-09auto merge of #9062 : blake2-ppc/rust/vec-iterator, r=alexcrichtonbors-43/+11
Visit the free functions of std::vec and reimplement or remove some. Most prominently, remove `each_permutation` and replace with two iterators, ElementSwaps and Permutations. Replace unzip, unzip_slice with an updated `unzip` that works with an iterator argument. Replace each_permutation with a Permutation iterator. The new permutation iterator is more efficient since it uses an algorithm that produces permutations in an order where each is only one element swap apart, including swapping back to the original state with one swap at the end. Unify the seldomly used functions `build`, `build_sized`, `build_sized_opt` into just one function `build`. Remove `equal_sizes`
2013-09-10std::at_vec and vec: Unify build_sized, build_sized_opt into buildblake2-ppc-43/+11
These functions have very few users since they are mostly replaced by iterator-based constructions. Convert a few remaining users in-tree, and reduce the number of functions by basically renaming build_sized_opt to build, and removing the other two. This for both the vec and the at_vec versions.
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-1/+1
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-1/+1
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-21std/extra: changing XXX to FIXME; cleanupTim Chevalier-2/+0
* Get rid of by-value-self workarounds; it works now * Remove type annotations, they're not needed anymore
2013-08-16doc: correct spelling in documentation.Huon Wilson-1/+1
2013-08-12std::at_vec: add benchmarksCorey Richardson-0/+81
2013-08-10Mass rename of .consume{,_iter}() to .move_iter()Erick Tryzelaar-8/+8
cc #7887
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-15/+2
2013-08-07std: Fix for-range loops that can use iteratorsblake2-ppc-3/+3
Fix inappropriate for-range loops to use for-iterator constructs (or other appropriate solution) instead.
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-4/+2
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-03remove obsolete `foreach` keywordDaniel Micay-5/+5
this has been replaced by `for`
2013-08-02replace `range` with an external iteratorDaniel Micay-5/+4
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-5/+5
2013-07-30implement pointer arithmetic with GEPDaniel Micay-1/+1
Closes #8118, #7136 ~~~rust extern mod extra; use std::vec; use std::ptr; fn bench_from_elem(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = vec::from_elem(1024, 0u8); } } fn bench_set_memory(b: &mut extra::test::BenchHarness) { do b.iter { let mut v: ~[u8] = vec::with_capacity(1024); unsafe { let vp = vec::raw::to_mut_ptr(v); ptr::set_memory(vp, 0, 1024); vec::raw::set_len(&mut v, 1024); } } } fn bench_vec_repeat(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = ~[0u8, ..1024]; } } ~~~ Before: test bench_from_elem ... bench: 415 ns/iter (+/- 17) test bench_set_memory ... bench: 85 ns/iter (+/- 4) test bench_vec_repeat ... bench: 83 ns/iter (+/- 3) After: test bench_from_elem ... bench: 84 ns/iter (+/- 2) test bench_set_memory ... bench: 84 ns/iter (+/- 5) test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-26Consolidate raw representations of rust valuesAlex Crichton-32/+27
This moves the raw struct layout of closures, vectors, boxes, and strings into a new `unstable::raw` module. This is meant to be a centralized location to find information for the layout of these values. As safe method, `repr`, is provided to convert a rust value to its raw representation. Unsafe methods to convert back are not provided because they are rarely used and too numerous to write an implementation for each (not much of a common pattern).
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-11/+24
2013-07-08Merge remote-tracking branch 'mozilla/master'Brian Anderson-7/+7
Conflicts: src/libextra/test.rs src/libstd/rt/global_heap.rs src/libstd/unstable/lang.rs src/libstd/vec.rs
2013-07-03Merge remote-tracking branch 'mozilla/master'Brian Anderson-12/+15
Conflicts: src/libextra/test.rs src/libstd/at_vec.rs src/libstd/cleanup.rs src/libstd/rt/comm.rs src/libstd/rt/global_heap.rs src/libstd/task/spawn.rs src/libstd/unstable/lang.rs src/libstd/vec.rs src/rt/rustrt.def.in src/test/run-pass/extern-pub.rs
2013-07-04Remove standalone comparison functions in vec, make the trait impls better.Huon Wilson-4/+5
2013-07-04Implement consuming iterators for ~[], remove vec::{consume, ↵Huon Wilson-3/+2
consume_reverse, map_consume}.
2013-06-29Removing a lot of usage of '&const'Alex Crichton-3/+3
2013-06-25auto merge of #7254 : Blei/rust/intrinsic-overhaul, r=cmrbors-3/+10
This sets the `get_tydesc()` return type correctly and removes the intrinsic module. See #3730, #3475. Update: this now also removes the unused shape fields in tydescs.
2013-06-24std: Rewrite vec_reserve_shared_actual in RustBrian Anderson-18/+44
2013-06-24remove old_iterDaniel Micay-2/+1
the `test/run-pass/class-trait-bounded-param.rs` test was xfailed and written in an ancient dialect of Rust so I've just removed it this also removes `to_vec` from DList because it's provided by `std::iter::to_vec` an Iterator implementation is added for OptVec but some transitional internal iterator methods are still left
2013-06-23Remove intrinsic modulePhilipp Brüschweiler-3/+10
To achieve this, the following changes were made: * Move TyDesc, TyVisitor and Opaque to std::unstable::intrinsics * Convert TyDesc, TyVisitor and Opaque to lang items instead of specially handling the intrinsics module * Removed TypeDesc, FreeGlue and get_type_desc() from sys Fixes #3475.
2013-06-23vec: remove BaseIter implementationDaniel Micay-3/+4
I removed the `static-method-test.rs` test because it was heavily based on `BaseIter` and there are plenty of other more complex uses of static methods anyway.
2013-06-18replace #[inline(always)] with #[inline]. r=burningtree.Graydon Hoare-9/+9
2013-06-16Add copies to type params with Copy boundNiko Matsakis-3/+3
2013-06-09remove unused import warningsHuon Wilson-2/+0
2013-05-30Require documentation by default for libstdAlex Crichton-2/+8
Adds documentation for various things that I understand. Adds #[allow(missing_doc)] for lots of things that I don't understand.
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-0/+2
2013-05-28Silence various warnings throughout test modulesAlex Crichton-1/+1
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-0/+323
This only changes the directory names; it does not change the "real" metadata names.