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: Replace num::IntConvertible with {To,From}Primitive
syntax: Add #[deriving(FromPrimitive)] syntax extension

Right now this only works for c-style enums.
syntax: swap from .span_fatal to .span_err in #[deriving(FromPrimitive)]
test: add compile-fail test for #[deriving(FromPrimitive)]
std: Swap {To,From}Primitive to use the 64bit as the unimplemented version

One downside with this current implementation is that since BigInt's
default is now 64 bit, we can convert larger BigInt's to a primitive,
however the current implementation on 32 bit architectures does not
take advantage of this fact.
extra: Add ToBigInt and ToBigUint traits
Use the correct logging crate while monomorphing

This makes sure that the top-level crate name is correct when emitting log
statements for a monomorphized function in another crate. This happens by
tracing the monomorphized ID back to the external source and then using that
crate index to get the name of the crate.

Closes #3046
Document logging and remove old functions

This adds a large doc-block to the top of the std::logging module explaining how
to use it. This is mostly just making sure that all the information in the
manual's section about logging is also here (in case someone decides to look
into this module first).

This also removes the old console_{on,off} methods. As far as I can tell, the
functions were only used by the compiler, and there's no reason for them to be
used because they're all turned off by default anyway (maybe they were turned on
by default at some point...)

I believe that this is the final nail in the coffin and closes #5021
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
Cache more results of const_eval

According to http://huonw.github.io/isrustfastyet/mem/#012f909, the "const
marking" pass generates about 400MB of extra memory during compilation. It
appears that this is due to two different factors:

    1. There is a `ccache` map in the ty::ctxt which is only ever used in this
       pass, so this commit moves the map out of the ty::ctxt struct and into
       just this pass's visitor. This turned out to not benefit that much in
       memory (as indicated by http://i.imgur.com/Eo4iOzK.png), but it's helpful
       to do nonetheless.

    2. During const_eval, there are a lot of lookups into decoding inlined items
       from external crates. There is no caching involved here, so the same
       static or variant could be re-translated many times. After adding
       separate caches for variants and statics, the memory peak of compiling
       rustc decreased by 200MB (as evident by http://i.imgur.com/ULAUMtq.png)

The culmination of this is basically a slight reorganization of a caching map
for the const_eval pass along with a 200MB decrease in peak memory usage when
compiling librustc.
Don't fail when unpacking the windows snapshot

Newly having a third-party directory was throwing off the unpack script
auto merge of #9722 : alexcrichton/rust/less-mem, r=sanxiyn

According to http://huonw.github.io/isrustfastyet/mem/#012f909, the "const
marking" pass generates about 400MB of extra memory during compilation. It
appears that this is due to two different factors:

    1. There is a `ccache` map in the ty::ctxt which is only ever used in this
       pass, so this commit moves the map out of the ty::ctxt struct and into
       just this pass's visitor. This turned out to not benefit that much in
       memory (as indicated by http://i.imgur.com/Eo4iOzK.png), but it's helpful
       to do nonetheless.

    2. During const_eval, there are a lot of lookups into decoding inlined items
       from external crates. There is no caching involved here, so the same
       static or variant could be re-translated many times. After adding
       separate caches for variants and statics, the memory peak of compiling
       rustc decreased by 200MB (as evident by http://i.imgur.com/ULAUMtq.png)

The culmination of this is basically a slight reorganization of a caching map
for the const_eval pass along with a 200MB decrease in peak memory usage when
compiling librustc.
Fix minor typo in std::str module docs
Fixed another minor typo in std::str docs
auto merge of #9726 : Valloric/rust/typo_fix, r=alexcrichton
auto merge of #9727 : Valloric/rust/doc-fixes, r=catamorphism