summary refs log tree commit diff
path: root/src/libstd/vec.rs
AgeCommit message (Collapse)AuthorLines
2013-07-08update ptr intrinsics and rewrite vec routines to be more correct.Niko Matsakis-40/+94
In particular, it is not valid to go around passing uninitialized or zero'd memory as arguments. Rust should generally be free to assume that the arguments it gets are valid input values, but the output of intrinsics::uninit() and intrinsics::init() are not (e.g., an @T is just null, leading to an error if we should try to increment the ref count).
2013-07-08 Replaces the free-standing functions in f32, &c.Jens Nockert-2/+2
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, float, int, and uint are replaced with generic functions in num instead. If you were previously using any of those functions, just replace them with the corresponding function with the same name in num. Note: If you were using a function that corresponds to an operator, use the operator instead.
2013-07-08auto merge of #7605 : thestinger/rust/vec, r=Aatchbors-20/+7
This is work continued from the now landed #7495 and #7521 pulls. Removing the headers from unique vectors is another project, so I've separated the allocator.
2013-07-08vec: make vec_reserve_shared_actual privateDaniel Micay-20/+7
2013-07-07remove some method resolve workaroundsDaniel Micay-2/+2
2013-07-07auto merge of #7602 : blake2-ppc/rust/vec-pop-opt, r=cmrbors-36/+78
Implement methods `.pop_opt() -> Option<T>` and `.shift_opt() -> Option<T>` to allow retrieval of front/back of a vec in one operation without fail. .pop() and .shift() are changed to reuse the former two methods. Follows the naming of the previous method .head_opt()
2013-07-05vec: Add .shift_opt() -> Option<T>blake2-ppc-12/+40
Add a function to safely retrieve the first element of a ~[T], as Option<T>. Implement shift() using shift_opt(). Add tests for both .shift() and .shift_opt()
2013-07-05vec: Add .pop_opt() -> Option<T>blake2-ppc-24/+38
Add a function to safely retrieve the last element of a ~[T], as Option<T>. Implement pop() using pop_opt(); it benches the same as the old implementation when tested with optimization level 2.
2013-07-05Change signature of Iterator.size_hintKevin Ballard-14/+14
Remove the Option wrapper around the lower bound. None is semantically the same as Size(0), so there's no point in having a distinction.
2013-07-03Merge pull request #7565 from Blei/fix-rev-size-hintDaniel Micay-1/+16
vec: Fix size_hint() of reverse iterators
2013-07-03Fail when a vec::reserve is too largeAlex Crichton-1/+14
2013-07-03Merge remote-tracking branch 'mozilla/master'Brian Anderson-1606/+820
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-04Convert vec::{as_imm_buf, as_mut_buf} to methods.Huon Wilson-54/+57
2013-07-04Convert vec::windowed to an external iterator, and add an n-at-a-time chunk ↵Huon Wilson-45/+132
iterator.
2013-07-04Convert vec::{split, splitn, rsplit, rsplitn} to external iterators.Huon Wilson-263/+158
2013-07-04Remove standalone comparison functions in vec, make the trait impls better.Huon Wilson-150/+133
2013-07-04Remove vec::reversed, replaced by iterators.Huon Wilson-27/+3
2013-07-04Remove vec::{filter, filtered, filter_map, filter_mapped}, replaced by ↵Huon Wilson-215/+0
iterators.
2013-07-04Implement consuming iterators for ~[], remove vec::{consume, ↵Huon Wilson-126/+94
consume_reverse, map_consume}.
2013-07-03vec: Fix size_hint() of reverse iteratorsPhilipp Brüschweiler-1/+16
Fixes #7558
2013-07-03auto merge of #7474 : Seldaek/rust/clean-iter, r=thestingerbors-10/+0
I think it's WIP - but I wanted to ask for feedback (/cc @thestinger) I had to move the impl of FromIter for vec into extra::iter because I don't think std can depend on extra, but that's a bit messed up. Similarly some FromIter uses are gone now, not sure if this is fixable or if I made a complete mess here..
2013-07-01auto merge of #7521 : thestinger/rust/vec, r=Aatchbors-12/+14
continued from #7495
2013-06-30auto merge of #7487 : huonw/rust/vec-kill, r=cmrbors-590/+251
Continuation of #7430. I haven't removed the `map` method, since the replacement `v.iter().transform(f).collect::<~[SomeType]>()` is a little ridiculous at the moment.
2013-06-30vec: implement exchange vector reserve in RustDaniel Micay-12/+14
2013-07-01Move most iter functionality to extra, fixes #7343Jordi Boggiano-10/+0
2013-06-30auto merge of #7495 : thestinger/rust/exchange, r=cmrbors-1/+29
With these changes, exchange allocator headers are never initialized, read or written to. Removing the header will now just involve updating the code in trans using an offset to only do it if the type contained is managed. The only thing blocking removing the initialization of the last field in the header was ~fn since it uses it to store the dynamic size/types due to captures. I temporarily switched it to a `closure_exchange_alloc` lang item (it uses the same `exchange_free`) and #7496 is filed about removing that. Since the `exchange_free` call is now inlined all over the codebase, I don't think we should have an assert for null. It doesn't currently ever happen, but it would be fine if we started generating code that did do it. The `exchange_free` function also had a comment declaring that it must not fail, but a regular assert would cause a failure. I also removed the atomic counter because valgrind can already find these leaks, and we have valgrind bots now. Note that exchange free does not currently print an error an out-of-memory when it aborts, because our `io` code may allocate. We could probably get away with a `#[rust_stack]` call to a `stdio` function but it would be better to make a write system call.
2013-06-30Remove vec::{map, mapi, zip_map} and the methods, except for .map, since thisHuon Wilson-113/+18
is very common, and the replacement (.iter().transform().collect()) is very ugly.
2013-06-30Convert vec::{grow, grow_fn, grow_set} to methods.Huon Wilson-63/+46
2013-06-30Convert vec::dedup to a method.Huon Wilson-39/+34
2013-06-30Convert vec::{bsearch, bsearch_elem} to methods.Huon Wilson-79/+88
2013-06-30Convert vec::{reverse, swap} to methods.Huon Wilson-42/+44
2013-06-30Convert vec::{rposition, rposition_elem, position_elem, contains} to methods.Huon Wilson-44/+24
2013-06-30Remove vec::[r]position_between, replaced by slices & iterators.Huon Wilson-102/+8
2013-06-30Remove vec::{rfind, rfind_between, find_between}, replaced by slices and ↵Huon Wilson-119/+0
iterator adapators.
2013-06-30vec: use contains_managed instead of box headerDaniel Micay-1/+29
2013-06-29minor vec cleanupDaniel Micay-10/+6
* hide the rustrt module in the docs * remove the useless `traits` module wrapping the `Add` impl
2013-06-29Removing a lot of usage of '&const'Alex Crichton-52/+20
2013-06-29'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep ↵Ben Blum-4/+4
for making them noncopyable.
2013-06-28Make default method handling not choke on self region params. Closes #7341.Michael Sullivan-2/+4
2013-06-28librustc: Disallow "mut" from distributing over bindings.Patrick Walton-3/+6
This is the backwards-incompatible part of per-binding-site "mut".
2013-06-28std: silence some test warnings.Huon Wilson-2/+2
2013-06-28Convert vec::{reserve, reserve_at_least, capacity} to methods.Huon Wilson-71/+71
2013-06-28Convert vec::{partition, partitioned} to methods.Huon Wilson-47/+28
2013-06-28Convert vec::retain to a method.Huon Wilson-22/+18
2013-06-28Convert vec::truncate to a method.Huon Wilson-16/+11
2013-06-28Convert vec::{push, push_all, push_all_move} to methods.Huon Wilson-85/+75
2013-06-28Convert vec::{pop, shift, unshift, insert, remove, swap_remove} to methods.Huon Wilson-133/+101
2013-06-27Convert vec::{head, tail, init, last} (and similar fns) to methods.Huon Wilson-50/+26
2013-06-27Convert vec::[mut_]slice to methods, remove vec::const_slice.Huon Wilson-63/+37
2013-06-26vec: remove superseded reverse_part functionDaniel Micay-40/+2
`reverse(xs.mut_slice(a, b))` replaces `reverse_part(xs, a, b)`