Tweak region inference to ignore constraints like 'a <= 'static, since they
have no value. This also ensures that we can handle some obscure cases of fn
subtyping with bound regions that we didn't used to handle correctly.

Fixes #13974.
rustc: Add official support for weak failure

This commit is part of the ongoing libstd facade efforts (cc #13851). The
compiler now recognizes some language items as "extern { fn foo(...); }" and
will automatically perform the following actions:

1. The foreign function has a pre-defined name.
2. The crate and downstream crates can only be built as rlibs until a crate
   defines the lang item itself.
3. The actual lang item has a pre-defined name.

This is essentially nicer compiler support for the hokey
core-depends-on-std-failure scheme today, but it is implemented the same way.
The details are a little more hidden under the covers.

In addition to failure, this commit promotes the eh_personality and
rust_stack_exhausted functions to official lang items. The compiler can generate
calls to these functions, causing linkage errors if they are left undefined. The
checking for these items is not as precise as it could be. Crates compiling with
`-Z no-landing-pads` will not need the eh_personality lang item, and crates
compiling with no split stacks won't need the stack exhausted lang item. For
ease, however, these items are checked for presence in all final outputs of the
compiler.

It is quite easy to define dummy versions of the functions necessary:

    #[lang = "stack_exhausted"]
    extern fn stack_exhausted() { /* ... */ }

    #[lang = "eh_personality"]
    extern fn eh_personality() { /* ... */ }

cc #11922, rust_stack_exhausted is now a lang item
cc #13851, libcollections is blocked on eh_personality becoming weak
std: Rebuild sync::deque on Arc

This also removes the `&mut self` requirement, using the correct `&self`
requirement for concurrent types.
std: Rebuild mpmc queues on Unsafe/Arc

This removes usage of UnsafeArc and uses proper self mutability for concurrent
types.
std: Rebuild mpsc queue with Unsafe/&self

This removes the incorrect `&mut self` taken because it can alias among many
threads.
std: Rebuild spsc with Unsafe/&self

This removes the incorrect usage of `&mut self` in a concurrent setting.
std: Use Arc instead of UnsafeArc in BlockedTask
std: Build Exclusive on Arc<Unsafe<T>>

This removes the usage of UnsafeArc
std: Move comm primitives away from UnsafeArc

They currently still use `&mut self`, this migration was aimed towards moving
from UnsafeArc<T> to Arc<Unsafe<T>>
std: Remove UnsafeArc

This type has been superseded by Arc<Unsafe<T>>. The UnsafeArc type is a relic
of an era that has long since past, and with the introduction of liballoc the
standard library is able to use the Arc smart pointer. With little need left for
UnsafeArc, it was removed.

All existing code using UnsafeArc should either be reevaluated to whether it can
use only Arc, or it should transition to Arc<Unsafe<T>>

[breaking-change]
native: Remove UnsafeArc in favor of just Arc
rustuv: Remove usage of UnsafeArc
green: Remove usage of UnsafeArc
Reset the terminal color before the newline for diagnostics

When printing colored diagnostics, we need to reset the terminal before
emitting the newline, not after. Otherwise it gets line-buffered and the
color won't reset until the next line is printed or the compiler exits.

Normally this isn't a problem, but when running rustc in parallel with
other processes (e.g. `make -j4`) this can cause the color to leak
to other lines.
auto merge of #14296 : kballard/rust/diagnostic_color_newline, r=alexcrichton

When printing colored diagnostics, we need to reset the terminal before
emitting the newline, not after. Otherwise it gets line-buffered and the
color won't reset until the next line is printed or the compiler exits.

Normally this isn't a problem, but when running rustc in parallel with
other processes (e.g. `make -j4`) this can cause the color to leak
to other lines.
Correct EBNF grammar in the manual

The grammar for use declarations was outdated.
auto merge of #14277 : pczarn/rust/manual-grammar, r=alexcrichton

The grammar for use declarations was outdated. Corrected some other mistakes.
compiletest: Refactor compile-fail to regex.
core: Improve docs for cell
std: Fix broken link