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
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 #8944 : alexcrichton/rust/issue-8938, r=huonw

Otherwise extra stuff after a lone '}' character is simply ignored, which is
very bad.

Closes #8938
str: rm `map_chars`, replaced by iterators

mapping a function against the elements should not require allocating a
new container, but `collect` still provides the functionality as-needed
Improve name mangling for gdb

Remove __extensions__ from method symbols as well as the meth_XXX. The XXX is
now used to append a few characters at the end of the name of the symbol.

Closes #6602
Move the `rt` build directory under $target

Closes #2302
Add an ``unreachable!()`` macro.

Rationale: having a function which fails means that the location of
failure which is output is that of the unreachable() function, rather
than the caller.

This is part of #8991 but is not all of it; current usage of
``std::util::unreachable()`` must remain so for the moment, until a new
snapshot is made; then I will remove that function entirely in favour of
using this macro.
auto merge of #8875 : alexcrichton/rust/fix-inner-static-library-bug, r=huonw

These commits fix bugs related to identically named statics in functions of implementations in various situations. The commit messages have most of the information about what bugs are being fixed and why.

As a bonus, while I was messing around with name mangling, I improved the backtraces we'll get in gdb by removing `__extensions__` for the trait/type being implemented and by adding the method name as well. Yay!
regression test for #7740.
auto merge of #8975 : alexcrichton/rust/reorganize, r=pnkfelix

Closes #2302
auto merge of #8990 : thestinger/rust/str, r=alexcrichton

mapping a function against the elements should not require allocating a
new container, but `collect` still provides the functionality as-needed
Factor shared code out into default GenericPath methods.
Minor doc cleanup.
auto merge of #8993 : pnkfelix/rust/fsk-fix-7740-dont-recur-on-items-during-gather-loans-of-block, r=nikomatsakis

Fix #7740

r? anyone, @nikomatsakis especially.