Commit Graph

1892 Commits

Author SHA1 Message Date
Tim Chevalier
239b81f111 std: Change str::from_bytes to raise a condition on invalid input
As per #4765
2013-06-07 17:42:50 -07:00
Daniel Micay
07e4d69baa iterator: work around method resolve bug (#5898) 2013-06-07 14:50:06 -04:00
Huon Wilson
54d914a9a9 std: remove each[i]_mut functions, in favour of iterators. 2013-06-08 03:24:27 +10:00
Huon Wilson
f661a15b2b std: remove vec::each2 and vec::each2_mut in favour of iterators 2013-06-08 01:20:47 +10:00
Huon Wilson
5e9f006c5b std: more dummy type parameters on iterators to work around #6967. 2013-06-08 01:10:27 +10:00
bors
74d9de7abd auto merge of #6979 : thestinger/rust/libc, r=brson
LLVM provides these functions as intrinsics, and will generate calls to
libc when appropriate. They are exposed in the `ptr` module as
`copy_nonoverlapping_memory`, `copy_memory` and `set_memory`.

@graydon: r?
2013-06-06 19:40:32 -07:00
Marvin Löbel
cac4891154 Fixups 2013-06-06 22:40:35 +02:00
Marvin Löbel
070015468d Removed IteratorUtil::to_vec and iter::to_vec 2013-06-06 22:11:48 +02:00
Marvin Löbel
857d433b9a Added IteratorUtil::collect 2013-06-06 22:11:48 +02:00
Marvin Löbel
af2086a2f1 Added iter::FromIter 2013-06-06 22:11:47 +02:00
Daniel Micay
8bcefef2f2 libc: omit memcpy, memmove and memset
LLVM provides these functions as intrinsics, and will generate calls to
libc when appropriate. They are exposed in the `ptr` module as
`copy_nonoverlapping_memory`, `copy_memory` and `set_memory`.
2013-06-06 15:18:45 -04:00
bors
0e96369224 auto merge of #6968 : huonw/rust/takeskip-iter, r=thestinger
@thestinger r?

Adding the dummy parameter stops the inference from having to work so hard.
2013-06-06 10:07:41 -07:00
Ramkumar Ramachandra
01c4f11cf8 libstd: use fmt! in to_str impl for (one|two)-tuple
The three-tuple uses fmt!, and there's no reason to hand-concatenate
strings.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-06 20:50:29 +05:30
Ramkumar Ramachandra
ab10b1ed29 libstd: fix comment in to_str impl of tuple
There is a pointer to #4760, which is a closed issue.  The real issue is
the more general problem described in #4653.  Correct the comment.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-06 20:50:29 +05:30
Alexei Sholik
e75572c879 Deduplicate words in code comments 2013-06-06 10:48:27 +03:00
Huon Wilson
32228f3d57 std: work-around for take/skip type inference (#6967) 2013-06-06 16:40:12 +10:00
Huon Wilson
848dbc93ee std: add an external iterator for mutating vec elements 2013-06-06 15:16:07 +10:00
John Clements
be22fddba0 rand example fixup 2013-06-05 12:01:39 -07:00
Patrick Walton
8114d0e950 librustc: Disallow multiple patterns from appearing in a "let" declaration.
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-06-04 21:45:42 -07:00
bors
9873f67e94 auto merge of #6942 : thestinger/rust/cleanup, r=catamorphism
borrowed pointers already implement Eq and Ord with deep comparisons
2013-06-04 17:55:34 -07:00
bors
cf2b00dc8b auto merge of #6941 : Thiez/rust/pub_atomics, r=thestinger
As the title suggests, this marks all the fns on the impls on the atomic types in std::unstable::atomics as pub, which makes them significantly more usable (they are rather unusable otherwise).
r?
2013-06-04 16:52:34 -07:00
Daniel Micay
5148e2f78b sys: get rid of shape functions
borrowed pointers already implement Eq and Ord with deep comparisons
2013-06-04 19:00:19 -04:00
Daniel Micay
61ac5fdab7 clone: fix docstring
@T and @mut T for T: Const have DeepClone
2013-06-04 18:40:50 -04:00
Matthijs Hofstra
979b037e5a Made fns in the impls for the Atomic structs pub 2013-06-05 00:37:52 +02:00
Philipp Brüschweiler
1eb3a35094 std::util: fix missed old constructor 2013-06-04 17:29:38 +02:00
Philipp Brüschweiler
3ce75e786d std::util: Modernize NonCopyable constructor
part of #3853
2013-06-04 14:08:25 +02:00
Philipp Brüschweiler
e1c1c059c6 std::io: Modernize some constructors
Part of #3853
2013-06-04 12:47:45 +02:00
Philipp Brüschweiler
34ee63e93b std::cell: Modernize constructors
Part of #3853
2013-06-04 12:03:58 +02:00
bors
133d451715 auto merge of #6886 : jld/rust/vec-each-ret-fix, r=sanxiyn 2013-06-03 18:55:29 -07:00
bors
846545a6e1 auto merge of #6907 : steveklabnik/rust/prelude_docs, r=graydon 2013-06-03 14:37:39 -07:00
Steve Klabnik
fe70361bb6 Add better documentation for the Prelude. 2013-06-03 11:49:06 -07:00
Daniel Micay
e900dba28a rename the Ptr trait to RawPtr
Closes #6607
2013-06-03 13:50:29 -04:00
Brendan Zabarauskas
dee7c5af69 Add traits for concat and connect methods 2013-06-03 13:19:37 +10:00
Daniel Micay
454133127a ptr: split out borrowed pointer utilities
The ptr module is intended to be for raw pointers.

Closes #3111
2013-06-02 19:24:33 -04:00
gareth
d443fc6d90 Add a get_mut method to accompany the get method. 2013-06-02 16:22:43 +01:00
bors
c354a0c7eb auto merge of #6896 : nickdesaulniers/rust/issue4501, r=brson
review? @brson
2013-06-01 22:37:35 -07:00
bors
14c331053e auto merge of #6815 : kballard/rust/hashmap-insert_or_modify_with, r=erickt
`std::hashmap::HashMap.insert_or_update_with()` is basically the opposite
of `find_or_insert_with()`. It inserts a given key-value pair if the key
does not already exist, or replaces the existing value with the output
of the passed function if it does.

This is useful because replicating this with existing functionality is awkward, especially with the current borrow-checker. In my own project I have code that looks like

	if match map.find_mut(&key) {
		None => { true }
		Some(x) => { *x += 1; false }
	} {
		map.insert(key, 0);
	}

and it took several iterations to make it look this good. The new function turns this into

    map.insert_or_update_with(key, 0, |_,x| *x += 1);
2013-06-01 21:31:36 -07:00
Nick Desaulniers
ecd08b989a Swap return value of pipes::init Fixes #4501 2013-06-01 18:19:16 -07:00
Kevin Ballard
75f1b7f96f Add new function hashmap.insert_or_update_with()
fn insert_or_update_with<'a>(&'a mut self,
                             k: K,
                             f: &fn(&K, &mut V)) -> &'a V
2013-06-01 17:38:24 -07:00
Kevin Ballard
7bc950c43c Refactor some hashmap code into a new private function mangle()
Add new private hashmap function

    fn mangle(&mut self,
              k: K,
              not_found: &fn(&K) -> V,
              found: &fn(&K, &mut V)) -> uint

Rewrite find_or_insert() and find_or_insert_with() on top of mangle().

Also take the opportunity to change the return type of find_or_insert()
and find_or_insert_with() to &'a mut V. This fixes #6394.
2013-06-01 17:37:57 -07:00
Jed Davis
c5d7a77a53 Fix vec::each* return values 2013-06-01 11:52:02 -07:00
Erick Tryzelaar
871684376f std: fix run tests when symlink is in the rust checkout path 2013-06-01 10:59:24 -07:00
Patrick Walton
5fb254695b Remove all uses of pub impl. rs=style 2013-06-01 09:18:27 -07:00
bors
2bf053c0a3 auto merge of #6851 : alexcrichton/rust/bugfixes, r=pcwalton
Closes #5090 by using the excellent new generic deriving code

Promotes the unreachable code attribute to a lint attribute (instead of always being a warning)

Fixes some edge cases when creating hashmaps/hashsets and also when consuming them. (fixes #5998)
2013-05-31 23:10:36 -07:00
bors
c23843c447 auto merge of #6876 : cmr/rust/from_elem_opts, r=Aatch
borrowck 1.85x speedup on libstd
2013-05-31 22:04:38 -07:00
Corey Richardson
c299230f3d Optimize vec::from_elem with manual inlining (borrowck 1.85x speedup on libstd) 2013-06-01 00:55:19 -04:00
bors
b570536b38 auto merge of #6729 : bstrie/rust/ascstr, r=Aatch
Formerly this was a free function rather than a method. I've left it in place for now, although redefined it so that it just calls the method.
2013-05-31 19:34:41 -07:00
bors
e516d2333f auto merge of #6864 : thestinger/rust/bool, r=pcwalton 2013-05-31 16:58:42 -07:00
Daniel Micay
1dc4ea004e bool: rm functions duplicating methods 2013-05-31 18:12:12 -04:00
Ben Striegel
c77d58fad8 Add as_c_str method on strings 2013-05-31 18:12:07 -04:00