about summary refs log tree commit diff
path: root/src/libstd/vec.rs
AgeCommit message (Collapse)AuthorLines
2013-07-12Account for possible 0-sized elements in vector iteratorsAlex Crichton-13/+68
Closes #7733
2013-07-12Remove the global 'vec::to_owned' functionAlex Crichton-5/+0
2013-07-12extend the iterator tutorialDaniel Micay-1/+1
documents conversion, size hints and double-ended iterators and adds more of the traits to the prelude
2013-07-11auto merge of #7707 : thestinger/rust/double, r=cmrbors-54/+35
00da76d r=cmr 6e75f2d r=cmr This implements the trait for vector iterators, replacing the reverse iterator types. The methods will stay, for implementing the future reverse Iterable traits and convenience. This can also be trivially implemented for circular buffers and other variants of arrays like strings. The `DoubleEndedIterator` trait will allow for implementing algorithms like in-place reverse on generic mutable iterators. The naming (`Range` vs. `Iterator`, `Bidirectional` vs. `DoubleEnded`) can be bikeshedded in the future.
2013-07-11auto merge of #7708 : bcully/rust/warnings, r=thestingerbors-1/+3
Just getting my feet wet.
2013-07-11vec: rm inline(never) hackDaniel Micay-13/+2
just avoid giving an inline hint in the first place
2013-07-11iterator: add DoubleEndedIterator conceptDaniel Micay-41/+33
This implements the trait for vector iterators, replacing the reverse iterator types. The methods will stay, for implementing the future reverse Iterable traits and convenience. This can also be trivially implemented for circular buffers and other variants of arrays like strings and `SmallIntMap`/`SmallIntSet`. The `DoubleEndedIterator` trait will allow for implementing algorithms like in-place reverse on generic mutable iterators. The naming (`Range` vs. `Iterator`, `Bidirectional` vs. `DoubleEnded`) can be bikeshedded in the future.
2013-07-10remove unused importsBrendan Cully-1/+3
2013-07-10Add a `mut_split()` method for dividing one `&mut [T]` into twoNiko Matsakis-0/+37
2013-07-10Merge pull request #7682 from thestinger/vecDaniel Micay-1/+20
vec::with_capacity: do one alloc for non-managed + ptr module improvements
2013-07-09vec::with_capacity: do one alloc for non-managedDaniel Micay-1/+20
2013-07-09auto merge of #7265 : brson/rust/io-upstream, r=brsonbors-10/+6
r? @graydon, @nikomatsakis, @pcwalton, or @catamorphism Sorry this is so huge, but it's been accumulating for about a month. There's lots of stuff here, mostly oriented toward enabling multithreaded scheduling and improving compatibility between the old and new runtimes. Adds task pinning so that we can create the 'platform thread' in servo. [Here](https://github.com/brson/rust/blob/e1555f9b5628af2b6c6ed344cad621399cb7684d/src/libstd/rt/mod.rs#L201) is the current runtime setup code. About half of this has already been reviewed.
2013-07-09auto merge of #7657 : thestinger/rust/rollup, r=thestingerbors-1/+1
d3be8ab r=brson 05eb3cf r=thestinger c80f4e1 r=huonw 8c27af1 r=huonw 0eee0b6 r=cmr ea2756a r=thestinger
2013-07-09Fix typo in docs for MutableCloneableVectorKevin Ballard-1/+1
2013-07-09auto merge of #7117 : jensnockert/rust/freestanding, r=cmrbors-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. This means that instead of having to know everywhere what the type is, like ~~~ f64::sin(x) ~~~ You can simply write code that uses the type-generic versions in num instead, this works for all types that implement the corresponding trait in num. ~~~ num::sin(x) ~~~ Note 1: If you were previously using any of those functions, just replace them with the corresponding function with the same name in num. Note 2: If you were using a function that corresponds to an operator, use the operator instead. Note 3: This is just https://github.com/mozilla/rust/pull/7090 reopened against master.
2013-07-08auto merge of #7578 : alexcrichton/rust/overflow, r=thestingerbors-1/+14
This should never cause a segfault, but rather fail somehow. Possibly a condition could be used here, but for now there's not much else to do.
2013-07-08TidyBrian Anderson-4/+2
2013-07-08Merge remote-tracking branch 'mozilla/master'Brian Anderson-906/+652
Conflicts: src/libextra/test.rs src/libstd/rt/global_heap.rs src/libstd/unstable/lang.rs src/libstd/vec.rs
2013-07-08Correct merge errorsNiko Matsakis-1/+1
2013-07-08Correct merge failuresNiko Matsakis-3/+3
2013-07-08Patch up some code that was using irrefutable patterns incorrectly.Niko Matsakis-3/+3
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