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.
* 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).
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");
~~~
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.
Added unit test to prevent similar mistakes from happening again. The
previous method was wrong because it dereferenced a pointer to a void type to
match on the result. No self pointer was needed, and the correct method
signature took the self value by value.
I feel silly that I made this mistake in https://github.com/mozilla/rust/pull/6348
As discussed on issue #4819. This is a naive implementation, trusting LLVM to do the relevant optimizations. In the future this could be implemented more efficiently, but it's a start.
Closes#2647
This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted. This involved pretty much rewriting how lints are emitted. Beforehand, only items could alter the lint settings, so whenever a lint was added it had to be associated with whatever item id it was coming from. I removed this (possibly questionably) in favor of just specifying a span and a message when adding a lint. When lint checking comes around, it looks at all the lints and sees which node with attributes best encloses it and uses that level of linting. This means that all consumer code doesn't have to deal with what item things came from (especially because functions on impls aren't items). More details of this can be found in the code (and comments).
As a bonus, I managed to greatly simplify emission of lints in resolve.rs about unused imports. Now instead of it manually tracking what the lint level is, it's all moved over into the lint module (as is to be expected).