Make the match arm type mismatch message point to the arm's span

Fixes #11319
libtest: Only colorize output if stdout is a tty

Fixes #14570.
doc: add an `.as_slice` example to the cheatsheet.

A lot of questions about this on IRC and stackoverflow.
auto merge of #14561 : jakub-/rust/issue-11319, r=alexcrichton

Fixes #11319
rustdoc: Refactor structure of html::run

Instead of one giant function, this breaks it up into several smaller functions
which have explicit dependencies among one another.

There are no code changes as a result of this commit.
rustdoc: Freeze the cache ASAP

The cache is going to be used earlier in the HTML generation process, which
means that it needs to get into TLS as soon as possible.
rustdoc: Show all implementors of traits

When inlining documentation across crates, primitive implementors of traits were
not shown. This commit tweaks the infrastructure to treat primitive and
Path-like impls the same way, displaying all implementors everywhere.

cc #14462
rustdoc: Stringify more named lifetimes

cc #14462
rustdoc: Fill in external type parameters correctly

Type parameters were filled in for some areas, but not all. This commit unifies
the two code paths to fill in type parameters everywhere.

Closes #14508
rustdoc: Create anchor pages for primitive types

This commit adds support in rustdoc to recognize the `#[doc(primitive = "foo")]`
attribute. This attribute indicates that the current module is the "owner" of
the primitive type `foo`. For rustdoc, this means that the doc-comment for the
module is the doc-comment for the primitive type, plus a signal to all
downstream crates that hyperlinks for primitive types will be directed at the
crate containing the `#[doc]` directive.

Additionally, rustdoc will favor crates closest to the one being documented
which "implements the primitive type". For example, documentation of libcore
links to libcore for primitive types, but documentation for libstd and beyond
all links to libstd for primitive types.

This change involves no compiler modifications, it is purely a rustdoc change.
The landing pages for the primitive types primarily serve to show a list of
implemented traits for the primitive type itself.

The primitive types documented includes both strings and slices in a semi-ad-hoc
way, but in a way that should provide at least somewhat meaningful
documentation.

Closes #14474
rustdoc: Filter inlining private external items

This prevents structures like RcBox from showing up in the documentation
rustdoc: Suck in all impls from external crates

There is currently no way to query all impls for a type from an external crate,
and with primitive types in play this is also quite difficult. Instead of
filtering, just suck in all impls from upstream crates into the local AST, and
have them get stripped later.

This will allow population of all implementations of traits for primitive types,
as well as filling in some corner cases with inlining documentation in other
cases.
doc: Fix a number of broken links

cc #14515
rustdoc: Fix cross-crate links to reexported items

Cross crate links can target items which are not rendered in the documentation.
If the item is reexported at a higher level, the destination of the link (a
concatenation of the fully qualified name) may actually lead to nowhere. This
fixes this problem by altering rustdoc to emit pages which redirect to the local
copy of the reexported structure.

cc #14515
Closes #14137
rustdoc: Don't inline tuple struct constructors

These don't actually point to anything, so there's no need to inline them.
syntax: Fix an accidental hyperlink in a comment
auto merge of #14513 : alexcrichton/rust/rustdoc-primitives, r=huonw

This is currently rebased on top of #14478, but that's just to preemptively avoid rebase conflicts and to provide a better preview. This can land independently of that PR.

This change crates a dedicated page in rustdoc for primitive types to outline everything you can do with them (at least in a basic way).

* Preview - http://people.mozilla.org/~acrichton/doc/
* Exhibit A - http://people.mozilla.org/~acrichton/doc/std/#primitives
* Exhibit B - http://people.mozilla.org/~acrichton/doc/std/primitive.str.html
* Exhibit C - http://people.mozilla.org/~acrichton/doc/std/primitive.slice.html

Please don't hesitate to be nitpickity, it's easy to overlook a thing here or there!
Fix docs for `core::result::Result::map`.

`reader.read_line()` includes trailing newline char, which makes
`from_str` always return `None`.
auto merge of #14571 : bnoordhuis/rust/libtest-check-isatty, r=alexcrichton

Fixes #14570.
auto merge of #14578 : huonw/rust/as_slice-cheatsheet, r=sfackler

doc: add an `.as_slice` example to the cheatsheet.

A lot of questions about this on IRC and stackoverflow.