Huon Wilson
5c147cc408
std::vec::bytes: remove the reference to overlapping src and dest in
...
docs for copy_memory.
&mut [u8] and &[u8] really shouldn't be overlapping at all (part of the
uniqueness/aliasing guarantee of &mut), so no point in encouraging it.
2013-12-17 08:36:04 +11:00
Huon Wilson
d0ae820765
std::vec::raw: convert copy_memory to a method.
2013-12-17 08:36:01 +11:00
Huon Wilson
ad20a78c54
std::vec::raw: convert init_elem to a method.
2013-12-17 08:35:34 +11:00
Huon Wilson
33b6bf4bc1
std::vec: remove aliasing &mut [] and &[] from shift_opt.
...
Also, dramatically simplify it with some tasteful raw pointers, rather
than treating everything as a nail with `transmute`.
2013-12-17 00:18:51 +11:00
Patrick Walton
a87786e3e9
librustc: Remove identifiers named box
, since it's about to become a keyword.
2013-12-15 10:41:15 -08:00
bors
8d52dfbace
auto merge of #10984 : huonw/rust/clean-raw, r=cmr
...
See commits for details.
2013-12-15 06:56:27 -08:00
Huon Wilson
164f7a290e
std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].
2013-12-15 23:37:41 +11:00
Huon Wilson
f53292f7ee
Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}.
2013-12-15 23:05:30 +11:00
Huon Wilson
4f62c969f6
std::vec: move pointless raw::get
and unsafe_get
functions.
...
This can easily be written as `(*v.unsafe_ref(i)).clone()`, or just
`*v.unsafe_ref(i)` for primitive types like `i32` (the common case).
2013-12-15 23:05:00 +11:00
Huon Wilson
0393c402a6
std::vec::raw: clean up docs.
2013-12-15 22:35:08 +11:00
Huon Wilson
a43bf3ff99
std::vec::bytes: remove obsolete functions.
...
These are less useful versions of the comparison operators and TotalOrd
trait.
2013-12-15 22:34:56 +11:00
Huon Wilson
f97040a93b
std::vec: remove unnecessary count parameter on {bytes,
...
raw}::copy_memory.
Slices carry their length with them, so we can just use that
information.
2013-12-15 22:23:11 +11:00
Huon Wilson
55534100ce
std: fix spelling in docs.
2013-12-15 16:26:09 +11:00
Eduard Burtescu
331c6efe45
Inline Finallyalizer::drop, allowing LLVM to optimize finally
.
...
* fixes the vec::from_elem regression caused by #8780
* added 5 benchmarks for allocating a 1KB ~[u8] and zeroing it
2013-12-12 07:07:45 +02:00
Erik Price
5731ca3078
Make 'self lifetime illegal.
...
Also remove all instances of 'self within the codebase.
This fixes #10889 .
2013-12-11 10:54:06 -08:00
Guillaume Pinot
44fc3c6ea8
add MutableVector::mut_split(self, pred) -> DoubleEndedIterator<&mut [T]>
...
This method is the mutable version of ImmutableVector::split. It is
a DoubleEndedIterator, making mut_rsplit irrelevent. The size_hint
method is not optimal because of #9629 .
At the same time, clarify *split* iterator doc.
2013-12-03 17:31:15 +01:00
Guillaume Pinot
25bb1a406c
rename MutableVector::mut_split(at) to MutableVector::mut_split_at(at)
2013-12-02 08:58:07 +01:00
Palmer Cox
2a8dfc3f22
Implement DoubleEndedIterator for MutChunkIter.
2013-11-30 19:54:28 -05:00
Palmer Cox
f2a01ea277
Implement mut_chunks() method for MutableVector trait.
...
mut_chunks() returns an iterator that produces mutable slices. This is the
mutable version of the existing chunks() method on the ImmutableVector trait.
2013-11-30 19:07:56 -05:00
Marvin Löbel
90f9eb3b1e
Removed a few macro-expanding-to-module workarounds
...
Also documented a few issues
2013-11-29 17:33:36 +01:00
bors
859c3baf64
auto merge of #10519 : nikomatsakis/rust/issue-8624-borrowck-overly-permissive, r=pnkfelix
...
See #8624 for details.
r? @pnkfelix
2013-11-28 03:51:32 -08:00
Patrick Walton
9521551b47
librustc: Fix merge fallout.
2013-11-26 11:04:39 -08:00
Patrick Walton
151b7ed52d
libstd: Fix Win32 and other bustage.
2013-11-26 08:25:27 -08:00
Patrick Walton
f571e46ddb
test: Remove non-procedure uses of do
from compiletest, libstd tests,
...
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26 08:25:27 -08:00
Patrick Walton
1eca34de7d
libstd: Remove all non-proc
uses of do
from libstd
2013-11-26 08:23:57 -08:00
Patrick Walton
9e610573ba
librustc: Remove remaining uses of &fn()
in favor of ||
.
2013-11-26 08:20:58 -08:00
Marvin Löbel
24b316a3b9
Removed unneccessary _iter
suffixes from various APIs
2013-11-26 10:02:26 +01:00
klutzy
87b166d94a
std: Remove unused attributes
...
This also enables two tests properly.
2013-11-26 13:24:11 +09:00
Niko Matsakis
ce44094bbb
Add [mut_]shift_ref/[mut_]pop_ref functions, which return a pointer to the first/last item in the slice and modify the slice to exclude the returned item. Useful when writing iterators over mutable references.
2013-11-25 06:41:26 -05:00
g3xzh
80dff18641
Add more benchmark tests to vec.rs
...
New benchmark tests in vec.rs:
`push`, `starts_with_same_vector`, `starts_with_single_element`,
`starts_with_diff_one_element_end`, `ends_with_same_vector`,
`ends_with_single_element`, `ends_with_diff_one_element_beginning` and
`contains_last_element`
2013-11-22 13:24:16 +02:00
Ziad Hatahet
248cb90dfa
std::ptr::read_ptr
now takes *T
instead of *mut T
...
Closes #10579
2013-11-21 11:31:58 -08:00
Patrick Walton
1946265e1a
libstd: Change all uses of &fn(A)->B
over to |A|->B
in libstd
2013-11-19 12:40:19 -08:00
Corey Richardson
a46b2b8e7a
vec: with_capacity: check for overflow
...
Fixes #10271
2013-11-11 06:09:28 -05:00
Daniel Micay
421c631570
add clone_from
and deep_clone_from
...
Closes #10240
2013-11-08 23:24:46 -05:00
Alex Crichton
4b770446b4
Register new snapshots
2013-11-06 20:24:36 -08:00
Niko Matsakis
3d1f3f4de0
Rename misleading contains_managed to owns_managed
2013-11-05 15:51:18 -05:00
Alex Crichton
daf5f5a4d1
Drop the '2' suffix from logging macros
...
Who doesn't like a massive renaming?
2013-10-22 08:09:56 -07:00
Brian Anderson
34d376f3cf
std: Move size/align functions to std::mem. #2240
2013-10-17 17:31:35 -07:00
bors
d773a024a2
auto merge of #9908 : alexcrichton/rust/snapshots, r=thestinger
2013-10-17 11:06:31 -07:00
Alex Crichton
0adb41d0eb
Register new snapshots
2013-10-17 10:12:23 -07:00
Kevin Ballard
2fcb53493d
Implement new methods vec.starts_with()/vec.ends_with()
2013-10-16 23:17:30 -07:00
Kevin Ballard
d8f82c8e43
Rewrite vec.contains() to be simpler
2013-10-16 23:17:26 -07:00
bors
c92f2168d4
auto merge of #9833 : alexcrichton/rust/fixes, r=brson
...
Commits have all the fun details
2013-10-16 18:11:22 -07:00
Alex Crichton
a84c2999c9
Require module documentation with missing_doc
...
Closes #9824
2013-10-15 22:27:10 -07:00
Daniel Micay
e1a26ad271
use element count in slices, not size in bytes
...
This allows the indexing bounds check or other comparisons against an
element length to avoid a multiplication by the size.
2013-10-15 16:23:28 -04:00
Huon Wilson
a6d7fe6209
std::vec: move documentation from impls to traits.
...
This means the text is visible in rustdoc.
2013-10-14 22:21:47 +11:00
bors
0bad7e1a37
auto merge of #9608 : hmarr/rust/vec-get-opt, r=huonw
...
This adds `get_opt` to `std::vec`, which looks up an item by index and returns an `Option`. If the given index is out of range, `None` will be returned, otherwise a `Some`-wrapped item will be returned.
Example use case:
```rust
use std::os;
fn say_hello(name: &str) {
println(fmt!("Hello, %s", name));
}
fn main(){
// Try to get the first cmd line arg, but default to "World"
let args = os::args();
let default = ~"World";
say_hello(*args.get_opt(1).unwrap_or(&default));
}
```
If there's an existing way of implementing this pattern that's cleaner, I'll happily close this. I'm also open to naming suggestions (`index_opt`?)
2013-10-12 20:16:19 -07:00
Alex Crichton
a8ba31dbf3
std: Remove usage of fmt!
2013-09-30 23:21:18 -07:00
Harry Marr
21b24e148b
Add get_opt to std::vec
2013-09-29 16:59:00 +01:00
bors
c635fba748
auto merge of #9583 : blake2-ppc/rust/connect-vec, r=huonw
...
std::vec: Sane implementations for connect_vec and concat_vec
Avoid unnecessary copying of subvectors, and calculate the needed space
beforehand. These implementations are simple but better than the
previous.
Also only implement it once, for all `Vector<T>` using:
impl<'self, T: Clone, V: Vector<T>> VectorVector<T> for &'self [V]
Closes #9581
2013-09-28 07:31:02 -07:00