auto merge of #12867 : alexcrichton/rust/issue-12860, r=thestinger

This switches a "tail call" to a manual loop to get around LLVM not optimizing
to a tail call.

Close #12860
auto merge of #12871 : aochagavia/rust/Optimize-while_some, r=alexcrichton

The old 'while' needed to match 2 times for each iteration. With the new 'loop' there is just one match needed.

I have also replaced 'blk' by 'f' to be more consistent with parameter names in other functions that are implemented for Option<T>
auto merge of #12874 : huonw/rust/printier-rustc, r=alexcrichton

rustc: make stack traces print for .span_bug/.bug.

Previously a call to either of those to diagnostic printers would defer
to the `fatal` equivalents, which explicitly silence the stderr
printing, including a stack trace from `RUST_LOG=std::rt::backtrace`.

This splits the bug printers out to their own diagnostic type so that
things work properly.

Also, this removes the `Ok(...)` that was being printed around the
subtask's stderr output.
auto merge of #12875 : alexcrichton/rust/demangle-more-things, r=brson

Add some more infrastructure support for demangling `$`-sequences, as well as fixing demangling of closure symbol names if there's more than one closure in a function.
Added support for type placeholders (explicit requested type
inference in a type with `_` ). This enables partial type inference.
auto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakis

# Summary

This patch introduces the `_` token into the type grammar, with the meaning "infer this type".
With this change, the following two lines become equivalent:
```
let x = foo();
let x: _ = foo();
```
But due to its composability, it enables partial type hints like this:
```
let x: Bar<_> = baz();
```

Using it on the item level is explicitly forbidden, as the Rust language does not enable global type inference by design.

This implements the feature requested in https://github.com/mozilla/rust/issues/9508.

# Things requiring clarification

- The change to enable it is very small, but I have only limited understanding of the related code, so the approach here might be wrong.
  - In particular, while this patch works, it does so in a way not originally intended according to the code comments.
- This probably needs more tests, or rather feedback for which tests are still missing.
- I'm unsure how this interacts with lifetime parameters, and whether it is correct in regard to them.
- Partial type hints on the right side of `as` like `&foo as *_` work in both a normal function contexts and in constexprs like `static foo: *int = &'static 123 as *_`. The question is whether this should be allowed in general.

# Todo for this PR

- The manual and tutorial still needs updating.

# Bugs I'm unsure how to fix

- Requesting inference for the top level of the right hand side of a `as` fails to infer correctly, even if all possible hints are given:

  ```
.../type_hole_1.rs:35:18: 35:22 error: the type of this value must be known in this context
.../type_hole_1.rs:35     let a: int = 1u32 as _;
                                           ^~~~
```
Fixed comment of as_mut_slice (libstd/option.rs)

The old comment did not describe the function correctly
auto merge of #12880 : tedhorst/rust/master, r=alexcrichton

Fix a test that was missed in the chan/port renaming (PR #12815).  This was missed because it is skipped on linux and windows, and the mac bots were moving at the time the PR landed.
Refactored iter and mut_iter

Replaced match by self.as_ref() and self.as_mut()
rustc: Fix cfg(not(a, b)) to be not(a && b)

Previously, the cfg attribute `cfg(not(a, b))` was translated to `(!a && !b)`,
but this isn't very useful because that can already be expressed as
`cfg(not(a), not(b))`. This commit changes the translation to `!(a && b)` which
is more symmetrical of the rest of the `cfg` attribute.

Put another way, I would expect `cfg(clause)` to be the opposite of
`cfg(not(clause))`, but this is not currently the case with multiple element
clauses.
std: Fix backtraces on arm linux

On android, libgcc is missing the _Unwind_GetIP symbol because it's defined as a
macro. This is the same case for arm linux, so this commit adds the necessary
cfgs in place to use the "expanded macro" in rust for arm linux.
debuginfo: Make limited-debuginfo test case more robust against GDB output variations.

Fixes issue #12787.
cmp: switch `min` and `max` to `TotalOrd`

The `Float` trait provides correct `min` and `max` methods on floating
point types, providing a consistent result regardless of the order the
parameters are passed.

These generic functions do not take the necessary performance hit to
correctly support a partial order, so the true requirement should be
given as a type bound.

Closes #12712
auto merge of #12869 : thestinger/rust/cmp, r=brson

The `Float` trait provides correct `min` and `max` methods on floating
point types, providing a consistent result regardless of the order the
parameters are passed.

These generic functions do not take the necessary performance hit to
correctly support a partial order, so the true requirement should be
given as a type bound.

Closes #12712
extra: Put the nail in the coffin, delete libextra

This commit shreds all remnants of libextra from the compiler and standard
distribution. Two modules, c_vec/tempfile, were moved into libstd after some
cleanup, and the other modules were moved to separate crates as seen fit.

Closes #8784
Closes #12413
Closes #12576
auto merge of #12878 : crabtw/rust/mips, r=alexcrichton

I ignored AtomicU64 methods on MIPS target
because libgcc doesn't implement MIPS32 64-bit atomic operations.
Otherwise it would cause link failure.

By the way, the patched LLVM doesn't have MIPS split stack anymore.
Should I file an issue about that?
auto merge of #12888 : aochagavia/rust/Fix-comment, r=alexcrichton

The old comment of as_mut_slice() did not describe the function correctly. The new one does.

Also refactored option::iter() and option::mut_iter() to use as_ref() and as_mut() instead of match.
auto merge of #12893 : alexcrichton/rust/cfg-not, r=luqmana

The two commits have the details of the two fixes
docs: begin a "low-level & unsafe code" guide.

This aims to cover the basics of writing safe unsafe code. At the moment
it is just designed to be a better place for the `asm!()` docs than the
detailed release notes wiki page, and I took the time to write up some
other things.

More examples are needed, especially of things that can subtly go wrong;
and vast areas of `unsafe`-ty aren't covered, e.g. `static mut`s and
thread-safety in general.
auto merge of #12887 : huonw/rust/danger-guide, r=alexcrichton

docs: begin a "low-level & unsafe code" guide.

This aims to cover the basics of writing safe unsafe code. At the moment
it is just designed to be a better place for the `asm!()` docs than the
detailed release notes wiki page, and I took the time to write up some
other things.

More examples are needed, especially of things that can subtly go wrong;
and vast areas of `unsafe`-ty aren't covered, e.g. `static mut`s and
thread-safety in general.