Commit Graph

2298 Commits

Author SHA1 Message Date
bors
d324014c6c auto merge of #7521 : thestinger/rust/vec, r=Aatch
continued from #7495
2013-07-01 02:26:46 -07:00
Huon Wilson
c437a16c5d rustc: add a lint to enforce uppercase statics. 2013-07-01 17:52:57 +10:00
bors
07feeb95c5 auto merge of #7487 : huonw/rust/vec-kill, r=cmr
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-30 21:14:13 -07:00
Daniel Micay
5b40f2ae5b pass exchange_malloc an alignment, not a tydesc 2013-06-30 23:30:40 -04:00
Daniel Micay
0d7799d304 global_heap: inline get_box_size and align_to 2013-06-30 22:41:51 -04:00
Daniel Micay
b731d96b4f vec: implement exchange vector reserve in Rust 2013-06-30 22:30:37 -04:00
Daniel Micay
80ab877841 global_heap: inline malloc_raw and add realloc_raw 2013-06-30 22:22:52 -04:00
bors
1c48aac9aa auto merge of #7517 : brson/rust/0.7, r=brson 2013-06-30 17:34:58 -07:00
Jordi Boggiano
3fe05a987c Move most iter functionality to extra, fixes #7343 2013-07-01 01:50:40 +02:00
Brian Anderson
a766a955a9 Bump version from 0.7-pre to 0.7 2013-06-30 16:36:48 -07:00
bors
040ac2a932 auto merge of #7495 : thestinger/rust/exchange, r=cmr
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-30 15:02:05 -07:00
Daniel Micay
4a29d6eb3f add a closure_exchange_malloc lang item
this makes the exchange allocation header completely unused, and leaves
it uninitialized
2013-06-30 16:24:47 -04:00
Daniel Micay
7f3752c7f9 managed: rm RC_EXCHANGE_UNIQUE constant
this is no longer used, exchange allocations do not set ref_count
2013-06-30 16:22:58 -04:00
Daniel Micay
408eef0d89 stop initializing ref_count in exchange_alloc
this is never read anymore
2013-06-30 16:22:55 -04:00
Alex Crichton
d3155faede Specialize to_str_common for floats/integers in strconv
This allows the integral paths to avoid allocations on the heap

Closes #4424, #4423
2013-06-30 09:19:25 -07:00
Alex Crichton
8fe6fc11de Change char::escape_{default,unicode} to take callbacks instead of allocating
strings
2013-06-30 09:19:02 -07:00
Huon Wilson
c0a20d2929 Remove vec::{map, mapi, zip_map} and the methods, except for .map, since this
is very common, and the replacement (.iter().transform().collect()) is very
ugly.
2013-06-30 21:59:44 +10:00
Huon Wilson
a396e1e2e9 Convert vec::{grow, grow_fn, grow_set} to methods. 2013-06-30 21:17:47 +10:00
Huon Wilson
2eea642c30 Convert vec::dedup to a method. 2013-06-30 21:17:09 +10:00
Huon Wilson
faa8f8ff8b Convert vec::{bsearch, bsearch_elem} to methods. 2013-06-30 21:15:25 +10:00
Huon Wilson
562dea1820 etc: update etc/unicode.py for the changes made to std::unicode. 2013-06-30 21:15:25 +10:00
Huon Wilson
9e83b2fe55 Convert vec::{reverse, swap} to methods. 2013-06-30 21:15:25 +10:00
Huon Wilson
a890c2cbf1 Convert vec::{rposition, rposition_elem, position_elem, contains} to methods. 2013-06-30 21:15:24 +10:00
Huon Wilson
45940ed988 Remove vec::[r]position_between, replaced by slices & iterators. 2013-06-30 21:06:48 +10:00
Huon Wilson
5d46bcc0e4 Remove vec::{rfind, rfind_between, find_between}, replaced by slices and iterator adapators. 2013-06-30 21:06:47 +10:00
Daniel Micay
350a5c0b72 vec: use contains_managed instead of box header 2013-06-30 03:45:39 -04:00
Daniel Micay
b91416214e add a contains_managed intrinsic 2013-06-30 03:45:39 -04:00
Daniel Micay
b883d6a54c simplify the exchange allocator
* stop using an atomic counter, this has a significant cost and
  valgrind will already catch these leaks
* remove the extra layer of function calls
* remove the assert of non-null in free, freeing null is well defined
  but throwing a failure from free will not be
* stop initializing the `prev`/`next` pointers
* abort on out-of-memory, failing won't necessarily work
2013-06-30 03:45:36 -04:00
bors
b4bb36490d auto merge of #7490 : mozilla/rust/rollup, r=thestinger
603137c r=cmr
fe10db2 r=bstrie
2013-06-29 23:34:43 -07:00
Alex Crichton
208eb0f8cb Implement map_mut on the Option type
Closes #7394
2013-06-29 22:21:37 -07:00
bors
c6b0d4f516 auto merge of #7475 : Seldaek/rust/fixsplit, r=cmr
I almost got locked out of my machine because I misunderstood the purpose of the function and called it with a limit of uint::max_value, which turned this function into an almost endless loop.
2013-06-29 21:13:31 -07:00
Daniel Micay
052f28a808 minor vec cleanup
* hide the rustrt module in the docs
* remove the useless `traits` module wrapping the `Add` impl
2013-06-29 17:37:03 -04:00
Daniel Micay
d820355213 fix code block syntax in two docstrings 2013-06-29 17:33:18 -04:00
bors
439b13f071 auto merge of #7449 : yichoi/rust/std_test, r=cmr
adjust run.rs test for android to pass check std
2013-06-29 14:31:41 -07:00
Alex Crichton
b29c368674 Removing a lot of usage of '&const' 2013-06-29 08:35:48 -07:00
Ben Blum
ff4ab9e147 'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep for making them noncopyable. 2013-06-29 04:39:34 -04:00
Ben Blum
5784c0912f Change taskgroup key type to fn:Copy in prep for noncopyable stack closures. 2013-06-29 03:58:50 -04:00
bors
4e78c1e2a8 auto merge of #7479 : mozilla/rust/rollup, r=thestinger
22b7eb3 r=thestinger 
28a3613 r=cmr
a0c31ec r=bstrie
ee7307e r=thestinger
b9cf6a3 r=thestinger
2013-06-28 22:25:48 -07:00
blake2-ppc
b9cf6a33d2 iterator: UnfoldrIterator::new should have function argument last
To match Rust conventions and enable use of `do` etc, make sure the
closure is the last argument to the `new` method.
2013-06-29 01:03:37 -04:00
Brian Anderson
22b7eb3802 Rename #[mutable] to #[no_freeze] 2013-06-29 00:56:36 -04:00
Jordi Boggiano
647b4a6bcd Optimize str::each_split_within when it is called with large limits 2013-06-29 04:53:52 +02:00
Michael Sullivan
a9e51f5f70 Make default method handling not choke on self region params. Closes #7341. 2013-06-28 16:12:08 -07:00
Corey Richardson
d600601162 Add each_parent to WindowsPath 2013-06-28 10:47:59 -04:00
Patrick Walton
10bcb60e8f librustc: Fix even *MORE* merge fallout! 2013-06-28 10:47:59 -04:00
Patrick Walton
f6a27cbda2 libextra: Fix even more merge fallout. 2013-06-28 10:47:56 -04:00
Patrick Walton
bb830558d1 librustc: Fix merge fallout and test cases. 2013-06-28 10:44:17 -04:00
Patrick Walton
e015bee286 Rewrite each_path to allow performance improvements in the future.
Instead of determining paths from the path tag, we iterate through
modules' children recursively in the metadata. This will allow for
lazy external module resolution.
2013-06-28 10:44:16 -04:00
Patrick Walton
89eb995195 librustc: Fix merge fallout. 2013-06-28 10:44:16 -04:00
Patrick Walton
03ab6351cc librustc: Rewrite reachability and forbid duplicate methods in type implementations.
This should allow fewer symbols to be exported.
2013-06-28 10:44:16 -04:00
Patrick Walton
a1531ed946 librustc: Remove the broken overloaded assign-ops from the language.
They evaluated the receiver twice. They should be added back with
`AddAssign`, `SubAssign`, etc., traits.
2013-06-28 10:44:16 -04:00
Patrick Walton
8cd40f9032 libstd: Fix merge fallout. 2013-06-28 10:44:15 -04:00
Patrick Walton
f9b54541ee librustc: Disallow "mut" from distributing over bindings.
This is the backwards-incompatible part of per-binding-site "mut".
2013-06-28 10:44:15 -04:00
Patrick Walton
1c0aa78481 librustc: Change "Owned" to "Send" everywhere 2013-06-28 10:44:15 -04:00
Patrick Walton
1eec3bba13 librustc: Rename Const to Freeze 2013-06-28 10:44:15 -04:00
Patrick Walton
d350981c0e librustc: Change Const to Freeze in the compiler 2013-06-28 10:44:15 -04:00
Patrick Walton
607b91d5f9 librustc: Rename Owned to Send in the compiler 2013-06-28 10:44:07 -04:00
bors
811e045c60 auto merge of #7426 : thestinger/rust/zero-size-noncopyable, r=catamorphism
4885918 r=huonw
42a63fc r=thestinger
7ec5a08 r=catamorphism
fb1e5f1 r=thestinger
659cd55 r=cmr
2013-06-28 05:28:32 -07:00
Young-il Choi
9b95b6d210 std: adjust run.rs test for android 2013-06-28 19:02:39 +09:00
bors
887ae82382 auto merge of #7397 : catamorphism/rust/rustpkg_path, r=catamorphism
r? @brson Unfortunately, the main test for this is ignored due to #7071.

Closes #5682
2013-06-28 02:58:34 -07:00
Tim Chevalier
ea62fd1090 rustpkg: Implement RUST_PATH
Unfortunately, the main test for this is ignored due to #7071.

Closes #5682
2013-06-27 21:41:03 -07:00
Daniel Micay
c45af01351 fix stage0 build 2013-06-28 00:23:38 -04:00
Young-il Choi
6b2297d118 std: unused import fix for android 2013-06-27 23:21:40 -04:00
Birunthan Mohanathas
dcf1dc060a Rename #[no_drop_flag] to #[unsafe_no_drop_flag] 2013-06-27 23:20:42 -04:00
Daniel Micay
779ee2a2dd util: make NonCopyable 0 size (instead of 1 byte)
this also adds a derived Eq, TotalEq, Ord and TotalOrd along with
removing the useless constructor
2013-06-27 23:20:42 -04:00
bors
63afb8ccc8 auto merge of #7430 : huonw/rust/vec-kill, r=thestinger 2013-06-27 15:01:58 -07:00
bors
9b6dfb8578 auto merge of #7414 : gifnksm/rust/max_by, r=catamorphism
`max_by` method returns the element that gives the maximum value from the specfied function.
`max_by`/`min_by` are convenient when you want to get the value which has greatest/smallest scores.

Inspired by [ruby's Enumerable module](http://ruby-doc.org/core-2.0/Enumerable.html).
2013-06-27 10:37:36 -07:00
Huon Wilson
366ca44cc8 std: silence some test warnings. 2013-06-28 01:45:24 +10:00
Huon Wilson
32d655916f Convert vec::{reserve, reserve_at_least, capacity} to methods. 2013-06-28 00:40:47 +10:00
Huon Wilson
ae2f185349 Convert vec::{partition, partitioned} to methods. 2013-06-28 00:20:43 +10:00
Huon Wilson
206d4f00dc Convert vec::retain to a method. 2013-06-28 00:20:42 +10:00
Huon Wilson
4470d14388 Convert vec::truncate to a method. 2013-06-28 00:20:42 +10:00
Huon Wilson
29b0649a6a Convert vec::{push, push_all, push_all_move} to methods. 2013-06-28 00:20:42 +10:00
Huon Wilson
1cb0a567d1 Convert vec::{pop, shift, unshift, insert, remove, swap_remove} to methods. 2013-06-28 00:20:42 +10:00
Huon Wilson
d2e3e1e52b Convert vec::{head, tail, init, last} (and similar fns) to methods. 2013-06-27 22:37:00 +10:00
Huon Wilson
d0512b1055 Convert vec::[mut_]slice to methods, remove vec::const_slice. 2013-06-27 22:36:09 +10:00
bors
a28f9ba526 auto merge of #7361 : brson/rust/incoming, r=brson 2013-06-27 01:04:33 -07:00
bors
f1e09d6f1f auto merge of #7420 : mozilla/rust/rollup, r=thestinger 2013-06-26 23:07:41 -07:00
Brian Anderson
ddbccecc27 std::rt: Some cleanup 2013-06-26 17:00:42 -07:00
Daniel Micay
9f5f609b1c vec: remove superseded reverse_part function
`reverse(xs.mut_slice(a, b))` replaces `reverse_part(xs, a, b)`
2013-06-26 19:42:34 -04:00
Ben Blum
12e09afd6d Work-around 'static bound requirement in io::with_bytes_reader (note: does not fix #5723, interface still unsafe) 2013-06-26 18:14:43 -04:00
Kevin Ballard
3df37326cf Add methods .move_from() and .copy_from() to vec
Add method .move_from() to MutableVector, which consumes another vector
and moves elements into the receiver.

Add new trait MutableCloneableVector with one method .copy_from(), which
clones elements from another vector into the receiver.
2013-06-26 18:12:29 -04:00
Kevin Ballard
524a92c72f Add method .set_memory in vec::bytes for &[u8]
Add new trait vec::bytes::MutableByteVector which currently defines one
method .set_memory().
2013-06-26 18:11:18 -04:00
gifnksm
8edb8f6d39 iterator: Add IteratorUtil::max_by/min_by method 2013-06-27 06:55:22 +09:00
Eric Reed
42f3f069fa changed NOTE to TODO 2013-06-26 13:48:49 -07:00
Eric Reed
ce97bd4c8b cleaned up uv/net 2013-06-26 10:17:10 -07:00
bors
3433851a37 auto merge of #7345 : blake2-ppc/rust/iterator-flat-map, r=thestinger
flat_map_ produces an iterator that maps each element to an iterator,
and yields the elements of the produced iterators.

This is the monadic bind :: M a -> (a -> M b) -> M b  for iterators.

Named just like the vec method, but with a trailing underline until the
method resolution bug is resolved.

We discussed the name chain_map, but I decided to go with flat_map_ for consistency with vec.

Since it.map(f).flatten()  would be the same as it.flat_map(f), we could choose
to just implement a flatten method instead. Either way the possibilities are the same but flat_map is more convenient.
2013-06-26 09:47:16 -07:00
Eric Reed
87ecfb7435 converted TCP interface to newtype structs 2013-06-26 09:37:48 -07:00
Eric Reed
d0dc6970d8 removed unecessary method 2013-06-26 09:37:16 -07:00
bors
4ec05e02fa auto merge of #7216 : kballard/rust/task_rng, r=brson 2013-06-26 03:08:04 -07:00
bors
09b4525f84 auto merge of #7113 : alexcrichton/rust/banned-warnings, r=cmr
Reopening of #7031, Closes #6963

I imagine though that this will bounce in bors once or twice... Because attributes can't be cfg(stage0)'d off, there's temporarily a lot of new stage0/stage1+ code.
2013-06-26 00:56:04 -07:00
bors
22408d9ad5 auto merge of #7269 : luqmana/rust/drop, r=thestinger
Finally rename finalize to drop.
Closes #4332.
2013-06-25 20:29:06 -07:00
Brian Anderson
5d3ca4b843 Merge remote-tracking branch 'mozilla/master' into incoming
Conflicts:
	src/librustc/middle/astencode.rs
	src/librustc/middle/check_const.rs
2013-06-25 19:32:00 -07:00
Luqman Aden
ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
Alex Crichton
c109bed15b Deny common lints by default for lib{std,extra} 2013-06-25 17:39:43 -07:00
Eric Reed
34b1135b59 Converted UdpSocket into a newtype struct and (dis)connecting uses move semantics rather than ~. 2013-06-25 17:05:59 -07:00
Eric Reed
f604686295 converted UvUdpSocket into a newtype struct 2013-06-25 17:04:28 -07:00
Eric Reed
c5b19f0bf9 changed outdated match on IpAddr 2013-06-25 16:04:09 -07:00
Eric Reed
d0c812f2a8 IPv6 struct 2013-06-25 16:03:24 -07:00
Eric Reed
2c5cfe1037 removed obsolete FIXMEs. formatting changes. 2013-06-25 16:02:51 -07:00
Eric Reed
f202713b73 satisfy the formatting check 2013-06-25 14:40:36 -07:00