Fix inner statics having the same symbol name

Before, the path name for all items defined in methods of traits and impls never
took into account the name of the method. This meant that if you had two statics
of the same name in two different methods the statics would end up having the
same symbol named (even after mangling) because the path components leading to
the symbol were exactly the same (just __extensions__ and the static name).

It turns out that if you add the symbol "A" twice to LLVM, it automatically
makes the second one "A1" instead of "A". What this meant is that in local crate
compilations we never found this bug. Even across crates, this was never a
problem. The problem arises when you have generic methods that don't get
generated at compile-time of a library. If the statics were re-added to LLVM by
a client crate of a library in a different order, you would reference different
constants (the integer suffixes wouldn't be guaranteed to be the same).

This fixes the problem by adding the method name to symbol path when building
the ast_map. In doing so, two symbols in two different methods are disambiguated
against.
Remove __extensions__ in names for a "pretty name"

As with the previous commit, this is targeted at removing the possibility of
collisions between statics. The main use case here is when there's a
type-parametric function with an inner static that's compiled as a library.
Before this commit, any impl would generate a path item of "__extensions__".
This changes this identifier to be a "pretty name", which is either the last
element of the path of the trait implemented or the last element of the type's
path that's being implemented.  That doesn't quite cut it though, so the (trait,
type) pair is hashed and again used to append information to the symbol.

Essentially, __extensions__ was removed for something nicer for debugging, and
then some more information was added to symbol name by including a hash of the
trait being implemented and type it's being implemented for. This should prevent
colliding names for inner statics in regular functions with similar names.
Move llvm into the artifacts build directory
Raise errors on format strings with unmatched `}`

Otherwise extra stuff after a lone '}' character is simply ignored, which is
very bad.

Closes #8938
Move the llvm auto-clean stamp into $target/llvm
Build rustllvm into $target/rustllvm
Added explicit pub to several conditions.  Enables completion of #6009.
Make non-pub condition! expand to non-pub mod.  Fix #6009.
Revise path.rs API to not allocate ~str so much.

Note that I left dirname as returning ~str, because both of its
implementations work by calling dir_path, which produces a new path,
and thus we cannot borrow the result from &'a self passed to dirname
(because the new path returned by dir_path will not live long enough
to satisfy the lifetime 'a).
Update clients of path.rs to use new API.

In most cases this involved removing a ~str allocations or clones
(yay), or coercing a ~str to a slice.  In a few places, I had to bind
an intermediate Path (e.g. path.pop() return values), so that it would
live long enough to support the borrowed &str.

And in a few places, where the code was actively using the property
that the old API returned ~str's, I had to put in to_owned() or
clone(); but in those cases, we're trading an allocation within the
path.rs code for one in the client code, so they neutralize each
other.
Another followup on #6009.

Odd that my earlier make checks did not catch this.
auto merge of #8977 : pnkfelix/rust/fsk-followup-on-6009-rebased, r=alexcrichton

Fix #6009.  Rebased version of #8970.  Inherits review from alexcrichton.
Fix #7740: gather_loans should not recur into the items of the block.

gather_loans does not need to recurse into any items declared in the
current block.  Rather than special-case `fk_item_fn` and `fk_method`,
just make the GatherLoanVisitor's visit_item method a no-op.

This indirectly implies that the example of #7740 is fixed:

    fn f() {
        static A: &'static char = &'A';
    }

Since we do not recurse into items, we no longer encounter `&'A'`.
Implement Stream automatically for Reader + Writer

This is consistent with the existing documentation but was not the
actual behaviour, which I've found to be rather a nuisance, actually.
auto merge of #8978 : pnkfelix/rust/make-path-api-less-allocation-happy, r=huonw

A [dialogue](https://github.com/mozilla/rust/pull/8909#discussion-diff-6102725) on PR #8909 inspired me to make this change.

r? anyone

(It is possible that `std::path` itself will soon be replaced with a new implementation that kballard's working on, as mentioned in the dialogue linked above, but this revision is simple enough that I figured I'd offer it up.)
Remove spurious comment in test for #1866.

It's no longer xfailed.
auto merge of #8986 : metajack/rust/rem-1866-xfail-comment, r=huonw

It's no longer xfailed.
forbid cast as bool

This is currently unsound since `bool` is represented as `i8`. It will
become sound when `bool` is stored as `i8` but always used as `i1`.

However, the current behaviour will always be identical to `x & 1 != 0`,
so there's no need for it. It's also surprising, since `x != 0` is the
expected behaviour.

Closes #7311
std::str: Deny surrogates in is_utf8

Reject codepoints \uD800 to \uDFFF which are the surrogates
(reserved/unused codepoints that are invalid to encode into UTF-8)

The surrogates is the only hole of invalid codepoints in the range from
\u0 to \u10FFFF.
auto merge of #8980 : thestinger/rust/bool, r=thestinger

This is currently unsound since `bool` is represented as `i8`. It will
become sound when `bool` is stored as `i8` but always used as `i1`.

However, the current behaviour will always be identical to `x & 1 != 0`,
so there's no need for it. It's also surprising, since `x != 0` is the
expected behaviour.

Closes #7311

d0a1176 r=huonw
e4a76e6 r=thestinger