Commit Graph

18602 Commits

Author SHA1 Message Date
bors
aa827838e1 auto merge of #6606 : thestinger/rust/vers, r=brson
I don't see a reason to encode this information in all the `extern mod` statements, it's not a precise enough version to actually provide any sort of robustness.
2013-05-18 21:55:30 -07:00
Daniel Micay
20ef4238bb reduce the usage of explicit version markers 2013-05-19 00:21:41 -04:00
Brendan Zabarauskas
d1e091a27a Add Ptr::to_option method 2013-05-19 14:08:27 +10:00
bors
ccf6353fd5 auto merge of #6589 : thestinger/rust/iterator, r=thestinger 2013-05-18 19:40:25 -07:00
Daniel Micay
1789174541 minor automated whitespace fixes 2013-05-18 22:40:12 -04:00
Daniel Micay
9b6b0e1e64 fix stage0 compile 2013-05-18 22:10:56 -04:00
bors
3ee479f3e9 auto merge of #6577 : brson/rust/io-upstream, r=pcwalton
r?

This is all of my scheduler work on #4419 from the last 3 weeks or so. I've had a few failed pull requests so far but I think the problems are ironed out.

* TCP
* The beginnings of runtime embedding APIs
* Porting various corners of core to be compatible with both schedulers
* libuv timer bindings
* Further refinement of I/O error handling, including a new, incomplete, `read_error` condition
* Incomplete refactoring to make tasks work without coroutines and user-space scheduling
* Implementations of Reader/Writer extension methods
* Implementations of the most important part of core::comm

I'm particularly happy with how easy the [comm types on top of the scheduler](https://github.com/brson/rust/blob/io-upstream/src/libcore/rt/comm.rs). Note that these implementations do not use pipes. If anything here needs careful review though it's this code.

This branch passes 95% of the run-pass tests (with `TESTARGS=--newrt`)

In the next week I'll probably spend some time adding preliminary multithreading and seeing how close we are to removing the old runtime.
2013-05-18 18:37:25 -07:00
bors
24c2be3323 auto merge of #6597 : bjz/rust/core-char, r=brson 2013-05-18 17:13:27 -07:00
Brian Anderson
8daa5ec9ea xfail-fast run-pass/core-rt-smoke 2013-05-18 16:35:58 -07:00
Brendan Zabarauskas
f687b9d771 Use /// style doc-comments and add missing headings 2013-05-19 06:45:54 +10:00
Brendan Zabarauskas
efe6564a0e Code modernisation and cleanup 2013-05-19 05:58:33 +10:00
Brendan Zabarauskas
d73f31b31d Create Char trait 2013-05-19 05:50:02 +10:00
Brendan Zabarauskas
7103c39dbb Move tuple tests into submodule 2013-05-19 02:36:08 +10:00
Brendan Zabarauskas
d9eec664fd Fix Ord implementation to use lexical ordering 2013-05-19 02:35:36 +10:00
Brendan Zabarauskas
db453ec0e5 Replace Tuple{2..12} trait with CloneableTuple{2..12} and ImmutableTuple{2..12}
Make n{0..11} methods return cloned values, and create n{0..12}_ref methods for returning references
2013-05-19 02:19:16 +10:00
Brendan Zabarauskas
ee4d11f37e Use match instead of intermediate variable 2013-05-19 02:19:16 +10:00
Brendan Zabarauskas
ce1e211eeb Adapt the getter macro to implement Clone, Eq and Ord for n-ary tuples 2013-05-19 02:19:16 +10:00
bors
3a323c1b2d auto merge of #6565 : osaut/rust/futures, r=thestinger
* The example given in future.rs was corrected.

* I have added a small section describing futures in tutorial on tasks. It is far from being complete as I am stil learning !

(This is an updated version of PR 6537).
2013-05-18 04:07:27 -07:00
bors
eb0e2f45ec auto merge of #6591 : bjz/rust/tuple-elements, r=thestinger
This commit implements element getters for tuples with an arity of 2 to 12. The getters return references to the elements, so no copying occurs. The traits are re-exported in `core::prelude` so you can use them from regular Rust code.

Here is an example of one of the getters in use:

~~~rust
assert_eq!((2, "hi", 75.0).n1(), &"hi");
~~~
2013-05-18 03:13:28 -07:00
Brendan Zabarauskas
b6038b7633 Return a reference to the tuple elements instead of copying 2013-05-18 20:05:40 +10:00
Olivier Saut
4b13895c2f Remove trailing whitespaces 2013-05-18 11:53:51 +02:00
Brendan Zabarauskas
5242464d54 Merge trait and impl macros by using an inner module 2013-05-18 19:43:14 +10:00
Brendan Zabarauskas
c1eb539e12 Use assert_eq! instead of assert! 2013-05-18 19:10:49 +10:00
Brendan Zabarauskas
96cb0dc8a0 use n{0..11} instead of _{0..12} for accessor method names 2013-05-18 19:10:12 +10:00
Brendan Zabarauskas
6742f91192 Create tuple element accessor traits 2013-05-18 18:59:16 +10:00
Daniel Micay
d953a5ce43 replace old_iter::repeat with the Times trait 2013-05-18 04:57:21 -04:00
Daniel Micay
fc656262a9 iterator: use advance to implement FilterMapIterator 2013-05-18 04:48:22 -04:00
Daniel Micay
073225572a iterator: reword docstring 2013-05-18 04:44:44 -04:00
Daniel Micay
883d583faa iterator: reuse iter::to_vec, and use &mut self 2013-05-18 04:37:48 -04:00
Daniel Micay
ea8a55b821 iterator: make nth and last return Option
There isn't a way to take the length of any iterator, so failing on a
zero length would make these much less useful.
2013-05-18 04:35:58 -04:00
Daniel Micay
a9c465ce1f iterator: remove first
it's the same as `next.unwrap()`, but there's no way to check the
length of an iterator so this isn't a good pattern
2013-05-18 04:35:48 -04:00
bors
e91daaa8a9 auto merge of #6586 : bjz/rust/formatting-and-conditionals, r=thestinger 2013-05-18 00:34:24 -07:00
Brendan Zabarauskas
ad6ee5f4e5 Use four-space indentation, add trailing commas, and remove unnecessary uses of the return keyword 2013-05-18 17:29:19 +10:00
Brendan Zabarauskas
60ea6d6957 Convert various inner doc-comments to outer doc-comments 2013-05-18 17:29:14 +10:00
Brendan Zabarauskas
728fe775a2 Use pattern-matching instead of conditionals where appropriate to improve code clarity 2013-05-18 17:29:12 +10:00
Brendan Zabarauskas
a10974da2d Use cond! macro where appropriate 2013-05-18 17:29:07 +10:00
bors
ac74bbec93 auto merge of #6582 : catamorphism/rust/cleanup, r=catamorphism 2013-05-17 21:49:25 -07:00
Tim Chevalier
f21fb3aff5 rustc: Cleaning up bad copies and other XXXes 2013-05-17 21:41:54 -07:00
bors
799d9fa32b auto merge of #6560 : gifnksm/rust/iterator-utils, r=thestinger
This pull request adds following methods and traits.
```rust
pub trait IteratorUtil {
(snip)
    fn filter_map<'r,  B>(self, f: &'r fn(A) -> Option<B>) -> FilterMapIterator<'r, A, B, Self>;
(snip)
    fn to_vec(self) -> ~[A];
    fn nth(&mut self, n: uint) -> A;
    fn first(&mut self) -> A;
    fn last(&mut self) -> A;
    fn fold<B>(&mut self, start: B, f: &fn(B, A) -> B) -> B;
    fn count(&mut self) -> uint;
    fn all(&mut self, f: &fn(&A) -> bool) -> bool;
    fn any(&mut self, f: &fn(&A) -> bool) -> bool;
}

pub trait AdditiveIterator<A> {
    fn sum(&mut self) -> A;
}

pub trait MultiplicativeIterator<A> {
    fn product(&mut self) -> A;
}

pub trait OrdIterator<A> {
    fn max(&mut self) -> Option<A>;
    fn min(&mut self) -> Option<A>;
}
```
2013-05-17 19:58:24 -07:00
bors
d68c0279ea auto merge of #6249 : crabtw/rust/arm, r=brson
It uses the private field of TCB head to store stack limit. I tested on my Raspberry PI. A simple hello world program ran without any problem. However, for a more complex program, it segfaulted as #6231.
2013-05-17 18:19:27 -07:00
Niko Matsakis
5ca383b777 Distinguish tuple elements by index in mem_categorization. Fixes #5362. 2013-05-17 21:12:50 -04:00
Brian Anderson
633af4c8ab Whitespace 2013-05-17 18:11:47 -07:00
Brian Anderson
df9e41278e core: Wire up stream to newsched 2013-05-17 17:54:32 -07:00
Brian Anderson
26becc308e core: Wire up oneshot pipes to newsched 2013-05-17 17:54:27 -07:00
Brian Anderson
f5987b03b8 core::rt: implement oneshot and stream. 2013-05-17 17:54:18 -07:00
Brian Anderson
03a8e59615 Merge remote-tracking branch 'brson/io' into incoming 2013-05-17 17:53:50 -07:00
bors
2d28d64542 auto merge of #6569 : Kimundi/rust/ext-bytes, r=erickt
Also snug in some cosmetic changes in num.rs that aren't really important enough for an separate pr.
2013-05-17 15:52:25 -07:00
Marvin Löbel
7a2afb7288 Made bytes!() accept a list of string, integer or char literals 2013-05-18 00:26:04 +02:00
Marvin Löbel
916942d006 Some cosmetic changes to num.rs 2013-05-18 00:25:03 +02:00
bors
c34c5051a5 auto merge of #6566 : brson/rust/libuv, r=brson
This cherry-picks a fix from upstream. It also includes another libuv patch that we were running but was accidentally removed in a submodule update.
2013-05-17 14:31:25 -07:00