std: iteratize str::is_utf16 & add tests.

Most of the tests are randomly generated with Python 3 and rely on it's
UTF-16be encoder/decoder being correct.
std: convert str::from_utf16 to an external iterator.

Fixes #12316.
str: provide lossy UTF-16 support.

This replaces the iterator with one that handles lone surrogates
gracefully and uses that to implement `from_utf16_lossy` which replaces
invalid `u16`s with U+FFFD.
std: decode even numbered non-BMP planes in the UTF-16 decoder.

Fixes #12318.
std: make str::from_utf16 return an Option.

The rest of the codebase is moving toward avoiding `fail!` so we do it
here too!
Made fail_bounds_check more careful with strings.

Fixes GH #11976.
Update compiler-rt

Closes #12356
auto merge of #12357 : chromatic/rust/gh_11976_fail_bounds_check_str, r=alexcrichton

Fixes #11976.
auto merge of #12359 : alexcrichton/rust/update-compiler-rt, r=luqmana

Closes #12356
Make priavcy checking aware that a `use` directive can point to two defintions (namespaces) with different privacy. Closes #4110
auto merge of #12245 : nick29581/rust/priv2, r=alexcrichton

closes #4110
str: add a function for truncating a vector of u16 at NUL.

Many of the functions interacting with Windows APIs allocate a vector of
0's and do not retrieve a length directly from the API call, and so need
to be sure to remove the unmodified junk at the end of the vector.
auto merge of #12317 : huonw/rust/utf16, r=alexcrichton

Iterators! Use them (in `is_utf16`), create them (in `utf16_items`).

Handle errors gracefully (`from_utf16_lossy`) and `from_utf16` returning `Option<~str>` instead of failing.

Add a pile of tests.
rustdoc: Only inject extern crates if not present
auto merge of #12361 : sfackler/rust/rustdoc-test-extern, r=alexcrichton
extra: json: add utility methods for PrettyEncoder

This makes it easier to pretty-print JSON. These utility methods already exist
for json::Encoder.
rustc: support dumping the AST as JSON

This is mostly useful for working on rustc, when one is unfamiliar with the
AST a particular construct will produce. It's a -Z flag as it's very much for
debugging.

Closes #10485