Expand the testing guide to cover optimizations, benchmarks and how to
be more precise about what's being benchmarked.

Also, reorganise the layout a bit, to put examples directly in their
sections.
std::io: Add `Chars` iterator for Buffer.

Add `std::io::Chars` iterator and `Buffer#chars()` method
auto merge of #12119 : huonw/rust/guide-testing, r=brson

be more precise about what's being benchmarked.

Also, reorganise the layout a bit, to put examples directly in their
sections.
auto merge of #12120 : gifnksm/rust/buffered-chars, r=alexcrichton

Add `std::io::Chars` iterator and `Buffer#chars()` method
auto merge of #12124 : brson/rust/intrinsics, r=thestinger

As mentioned https://github.com/mozilla/rust/pull/11956#issuecomment-34561655 I've taken some of the most commonly-used intrinsics and put them in a more logical place, reduced the amount of code looking in `unstable::intrinsics`.

r? @thestinger
rustc: Add the __tt_map_insert and __tt_map_get_expr macros

Behind the `__tt_map` feature gate. This feature name starts with
a double underscore to emphasize it's a hack, but there's no
precedent for naming features this way.
rustc: Introduce a new diagnostic code registry

This provides a way to create stable diagnostic codes, while keeping
the overal burden on compiler writers low, and introducing a way to
incrementally provide extended documentation of diagnostics.
Introduce more diagnostic infrastructure
Convert to new diagnostics

This pairs almost every error in libsyntax and librustc with an error code,
emitting with the macros:

* alert_fatal!(cx, code, fmt, args);
* alert_err!(cx, code, fmt, args);
* alert_warn!(cx, code, fmt, args);
* span_fatal!(cx, span, code, fmt, args);
* span_err!(cx, span, code, fmt, args);
* span_warn!(cx, span, code, fmt, args);
* resolve_err!(cx, span, code, fmt, args);

These macros call the methods 'fatal_without_diagnostic_code' etc. on any
given context. For the most part the old diagnostic methods on the various
sessions and handles and contexts have been renamed in a way that is
obnoxious to call (use the macros), but the macro ExtCtxt still contains
the simple `fatal` methods, etc. for ease of use by out of tree procedural
macros.

Lint errors are difficult to convert to this system because they don't use
string literals for reporting errors, so they don't have their own codes yet.
rustc: Add UI for extended diagnostics

When diagnostics with codes are emitted they appear in magenta brackets,
like `[A0002]`. After failure a note is emitted indicating whether
any errors had extended documentation and suggesting the `--explain help`
flag.
Slightly improve the format of the diagnostic database.