Add get_opt to std::vec
std::iter: Introduce .by_ref() adaptor

Creates a wrapper around a mutable reference to the iterator.

This is useful to allow applying iterator adaptors while still
retaining ownership of the original iterator value.

Example::

   let mut xs = range(0, 10);
   // sum the first five values
   let partial_sum = xs.by_ref().take(5).fold(0, |a, b| a + b);
   assert!(partial_sum == 10);
   // xs.next() is now `5`
   assert!(xs.next() == Some(5));
std::rt::uv::net: Handle `read_start` error

cc #9605
std::rt: Add NotConnected to IoErrorKind
rt::io::net::tcp: Fix eof_twice tests on Win32

cc #8811
Implement io::native::file
Implement io::native::stdio
Implement io::native::process
syntax: allow macros to expand to items with attributes.

Fixes #4471.
auto merge of #9783 : huonw/rust/macro-items, r=bstrie

Fixes #4471.
Use the result of privacy for reachability

This fixes a bug in which the visibility rules were approximated by
reachability, but forgot to cover the case where a 'pub use' reexports a private
item. This fixes the commit by instead using the results of the privacy pass of
the compiler to create the initial working set of the reachability pass.

This may have the side effect of increasing the size of metadata, but it's
difficult to avoid for correctness purposes sadly.

Closes #9790
Implement rt::io::stdio

Additionally, this moves the prelude imports of print/println from std::io to
std::rt::io.

Closes #6846
Implement BufferedReader.{read_until, read_line}

These two functions will be useful when replacing various other counterparts
used by std::io consumers.
Move std::run off of std::io

This changes the implementation to instead use rt::io::native::process as well
as an example of using those bindings.
Migrate users of io::fd_t to io::native::file::fd_t
Remove usage of io::FILE_writer
Remove some users of io::file_reader
Make the file::DirectoryInfo trait public

This was just a mistake that it was hidden.
auto merge of #9749 : alexcrichton/rust/less-io, r=brson

This implements a number of the baby steps needed to start eliminating everything inside of `std::io`. It turns out that there are a *lot* of users of that module, so I'm going to try to tackle them separately instead of bringing down the whole system all at once.

This pull implements a large amount of unimplemented functionality inside of `std::rt::io` including:

* Native file I/O (file descriptors, *FILE)
* Native stdio (through the native file descriptors)
* Native processes (extracted from `std::run`)

I also found that there are a number of users of `std::io` which desire to read an input line-by-line, so I added an implementation of `read_until` and `read_line` to `BufferedReader`.

With all of these changes in place, I started to axe various usages of `std::io`. There's a lot of one-off uses here-and-there, but the major use-case remaining that doesn't have a fantastic solution is `extra::json`. I ran into a few compiler bugs when attempting to remove that, so I figured I'd come back to it later instead. 

There is one fairly major change in this pull, and it's moving from native stdio to uv stdio via `print` and `println`. Unfortunately logging still goes through native I/O (via `dumb_println`). This is going to need some thinking, because I still want the goal of logging/printing to be 0 allocations, and this is not possible if `io::stdio::stderr()` is called on each log message. Instead I think that this may need to be cached as the `logger` field inside the `Task` struct, but that will require a little more workings to get right (this is also a similar problem for print/println, do we cache `stdout()` to not have to re-create it every time?).
Add `pub` to all the codegen tests

Otherwise the test function is internalized and LLVM will most likely optimize
it out.