Commit Graph

20889 Commits

Author SHA1 Message Date
bors
ba3d03d3a4 auto merge of #8312 : alexcrichton/rust/use-treemap, r=erickt
Closes #4430
2013-08-06 07:05:05 -07:00
bors
ca6385034c auto merge of #8308 : blake2-ppc/rust/str-slice-bytes, r=alexcrichton
`fn slice_bytes` is marked unsafe since it allows violating the valid
string encoding property; but the function did also allow extending the
lifetime of the slice by mistake, since it's returning `&str`.

Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so
that all uses of `slice_bytes` are region checked correctly.
2013-08-06 05:26:01 -07:00
bors
8adcba4300 auto merge of #8054 : sammykim/rust/move-EnumSet, r=alexcrichton
Fix #8004
2013-08-06 02:26:06 -07:00
Kevin Ballard
3db3ce22f5 Update Iterator impls to use Saturating
Replace hand-rolled saturation math with calls to Saturating.

Fix one impl that didn't use saturating math.
2013-08-05 22:49:33 -07:00
Kevin Ballard
5f713da4aa Add std::num::Saturating
Saturating is an implementation of saturating math operations (at the
moment just add and sub) for integral types.
2013-08-05 22:49:33 -07:00
Sangeun Kim
a76943be47 Move EnumSet into libextra 2013-08-06 14:45:02 +09:00
bors
f8cf234b34 auto merge of #8265 : blake2-ppc/rust/std-iter, r=thestinger
Fix #8228 by replacing .iter() and .iter_err() in Result by external iterators.

Implement random access for `iterator::Invert` and `vec::ChunkIter` (and bidirectionality).

Implement Repeat iterator.
2013-08-05 22:38:15 -07:00
bors
6f88f4dea5 auto merge of #8278 : cmr/rust/workaround, r=brson 2013-08-05 20:07:59 -07:00
blake2-ppc
45085b9f8d std: Fix bug in ChunkIter::idx
ChunkIter .idx() didn't handle overflow correctly, even though it tried.
2013-08-06 04:05:08 +02:00
blake2-ppc
ea9c5c405e std: Remove uint::iterate, replaced by range 2013-08-06 04:05:08 +02:00
blake2-ppc
08d0b70213 extra: Simplify the bitv iterators using Repeat 2013-08-06 04:05:08 +02:00
blake2-ppc
b5cd81d0e5 std: Improve the documentation for iterator::Invert 2013-08-06 04:05:08 +02:00
blake2-ppc
520f292e48 std: Use method name Option::consume
With Option as the simplest container, `consume` is the way to turn it
into a by-value iterator.
2013-08-06 04:05:07 +02:00
blake2-ppc
78effe7626 std: Rewrite the HashSet set operation iterators
Use the Repeat iterator to carry the "explicit closure capture" that was
previously done with the custom EnvFilterIterator.
2013-08-06 04:05:07 +02:00
blake2-ppc
8046218f0f std: Add iterator::Repeat to repeat an element endlessly 2013-08-06 04:05:07 +02:00
blake2-ppc
a05a9a1c02 std: Improve vec::ChunkIter
Implement clone, bidirectionality and random access for this iterator
2013-08-06 04:05:07 +02:00
blake2-ppc
872d15d464 std: Implement RandomAccessIterator for Invert 2013-08-06 04:05:07 +02:00
blake2-ppc
c5e4c55989 std: Remove unused trait bound in Result::map 2013-08-06 04:05:07 +02:00
blake2-ppc
109e0d85a1 std: Convert Result to use external iterators
convert iter() and iter_err() for Result. Use OptionIterator.
2013-08-06 04:02:21 +02:00
blake2-ppc
ce682cb45f std: Add .consume_iter() for Option, to make it reusable
Let Option be a base for a widely useful one- or zero- item iterator.
Refactor OptionIterator to support any generic element type, so the same
iterator impl can be used for both &T, &mut T and T iterators.
2013-08-06 03:59:56 +02:00
Alex Crichton
d5de801cc1 Re-enable rusti tests 2013-08-05 18:55:53 -07:00
bors
bbda3fa938 auto merge of #8288 : Kimundi/rust/opteitres4, r=brson
This is an alternative version to https://github.com/mozilla/rust/pull/8268, where instead of transitioning to `get()` completely, I transitioned to `unwrap()` completely.

My reasoning for also opening this PR is that having two different functions with identical behavior on a common datatype is bad for consistency and confusing for users, and should be solved as soon as possible. The fact that apparently half the code uses `get()`, and the other half `unwrap()` only makes it worse.

If the final naming decision ends up different, there needs to be a big renaming anyway, but until then it should at least be consistent.

---

- Made naming schemes consistent between Option, Result and Either
- Lifted the quality of the either and result module to that of option
- Changed Options Add implementation to work like the maybe Monad (return None if any of the inputs is None)  
  See https://github.com/mozilla/rust/issues/6002, especially my last comment.
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead  
  See also https://github.com/mozilla/rust/issues/7887.

Todo: 

Adding testcases for all function in the three modules. Even without the few functions I added, the coverage wasn't complete to begin with. But I'd rather do that as a follow up PR, I've touched to much code here already, need to go through them again later.
2013-08-05 16:47:01 -07:00
Ben Blum
1f95bd7684 Lazily initialize 'leaf node' taskgroups for unlinked spawns, for an apparent 11% speedup. 2013-08-05 19:30:25 -04:00
Ben Blum
47e82c8555 (cleanup) Uncomment an assertion that now holds. 2013-08-05 18:40:42 -04:00
bors
29099e450a auto merge of #8298 : darkf/rust/fix-3948, r=pcwalton 2013-08-05 13:49:55 -07:00
Marvin Löbel
0ac7a219f0 Updated std::Option, std::Either and std::Result
- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05 22:42:21 +02:00
Alex Crichton
991648d099 Use TreeMap's ord implementation for Json
Closes #4430
2013-08-05 13:20:48 -07:00
Michael Sullivan
53c6de5684 Improve debug spew in _match. 2013-08-05 12:30:28 -07:00
Michael Sullivan
7dbc5ae79f Get rid of some NOTEs. 2013-08-05 12:30:28 -07:00
Michael Sullivan
fd01031f3a Warn when using -o option on libraries. Closes #6554. 2013-08-05 11:41:06 -07:00
Michael Sullivan
a20081666b Fix an unused variable warning and clean up some dead code/names. 2013-08-05 11:41:06 -07:00
bors
d8b299d179 auto merge of #8293 : dim-an/rust/trie-iterator, r=thestinger
Closes #5506.
2013-08-05 11:28:56 -07:00
Michael Sullivan
bcf62e7901 Make node_id_to_str print more useful info in some cases. Closes #2410. 2013-08-05 10:33:55 -07:00
bors
2d1eb1916e auto merge of #8292 : thestinger/rust/fix_loop_warning, r=brson 2013-08-05 09:49:56 -07:00
blake2-ppc
476dfc24b3 std: Use correct lifetime parameter on str::raw::slice_bytes
fn slice_bytes is marked unsafe since it allows violating the valid
string encoding property; but the function did also allow extending the
lifetime of the slice by mistake, since it's returning `&str`.

Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so
that all uses of slice_bytes are region checked correctly.
2013-08-05 17:55:06 +02:00
bors
d89ff7eef9 auto merge of #8289 : sfackler/rust/push_byte, r=erickt
It was previously pushing the byte on top of the string's null
terminator. I added a test to make sure it doesn't break in the future.
2013-08-05 08:10:55 -07:00
bors
c2bacd2e80 auto merge of #8183 : omasanori/rust/migrate-new, r=sanxiyn
It seems that relatively new code uses `Foo::new()` instead of `Foo()` so I wrote a patch to migrate some structs to the former style.
Is it a right direction? If there are any guidelines not to use new()-style, could you add them to the [style guide](https://github.com/omasanori/rust/wiki/Note-style-guide)?
2013-08-05 06:22:57 -07:00
bors
dbaca98d78 auto merge of #8279 : pcwalton/rust/no-main, r=brson
Useful for SDL and possibly Android too.

r? @brson
2013-08-05 04:37:58 -07:00
bors
4db061160d auto merge of #8227 : dim-an/rust/tree-iter, r=thestinger 2013-08-05 02:52:55 -07:00
OGINO Masanori
eab97b5558 Add extra::arena::Arena::new{, _with_size}.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-05 17:43:40 +09:00
bors
7b2163d376 auto merge of #8303 : brson/rust/tls-magic-wtf, r=brson 2013-08-05 00:56:00 -07:00
Brian Anderson
1c1add23f6 std::rt: Use magic to make TLS work from annihilated boxes. #8302 2013-08-05 00:36:02 -07:00
bors
4fdd720421 auto merge of #8299 : brson/rust/yet-more-newsched-fixes, r=brson 2013-08-04 23:16:59 -07:00
Brian Anderson
167bdff041 std::rt: Schedule more scheduler callbacks to avoid dropping messages 2013-08-04 21:56:48 -07:00
Brian Anderson
d123df26ff std: Fix newsched logging truncation
The truncation needs to be done in the console logger in order
to catch all the logging output, and because truncation only matters
when outputting to the console.
2013-08-04 21:56:47 -07:00
darkf
180d050138 Open files in binary mode. Closes #3948 2013-08-04 21:54:24 -07:00
bors
83d2a0431c auto merge of #8220 : luqmana/rust/arm-linux, r=cmr
Update the arm linux support some more. We had a previous patch for the RasberryPi. This adds a new target `arm-unknown-linux-gnueabi` for more general arm linux support.

Build/Host machine: x86_64 Debian testing (jessie) with the `gcc-4.4-arm-linux-gnueabi` package

Tested on targets:

- TS-7800 Feroceon (ARMv5TEJ) running Debian 7.0 wheezy
- Beaglebone black (ARMv7) running Angstrom GNU/Linux v2012.12
   - rustc flags:  `--target=arm-unknown-linux-gnueabi --linker=arm-linux-gnueabi-gcc`

- Samsung Galaxy S II (to make sure android still works)
   - rustc flags:  `--target=arm-linux-androideabi --android-cross-path=[path to standalone toolchain]`

Since not all arm devices (i.e. afaik anything older than armv6 like the ts-7800 i tested on) supported getting the tls address via the `mrc` instruction, I made it also try via the magic address the kernel maps into the address space (0xFFFF0FF0). One or the other should work (and on android it seems like both work).

Also fixes a bug where rustc would always try to invoke the android assembler for any kind of arm target.
2013-08-04 21:34:54 -07:00
bors
6c12ca3ac2 auto merge of #8297 : brson/rust/dlist-dtor, r=brson
The compiler-generated dtor for DList recurses deeply to drop Nodes.
For big lists this can overflow the stack.

This is a problem for the new scheduler, where split stacks are not implemented.

Thanks @blake2-ppc
2013-08-04 19:52:57 -07:00
Brian Anderson
4898a0de04 extra: Don't recurse in DList drop glue. #8295
The compiler-generated dtor for DList recurses deeply to drop Nodes.
For big lists this can overflow the stack.
2013-08-04 18:38:06 -07:00
bors
dc5b0b9410 auto merge of #8282 : brson/rust/more-newsched-fixes, r=brson 2013-08-04 18:10:53 -07:00