Fix two bugs in HRTB: 1. Categorize early-vs-late bindings on impls when constructing    generics, so that we don't add unnecessary region parameters. 2. Correct the DeBruijn indices when substituting the self type    into the method signature.

Previously, the DeBruijn index for the self type was not being
adjusted to account for the fn binder. This mean that when late-bound
regions were instantiated, you sometimes wind up with two distinct
lifetimes.

Fixes #19537.
During method resolution, only reborrow if we are not doing an auto-ref.
The current behavior leads to adjustments like `&&*` being applied
instead of just `&` (when the unmodified receiver is a `&T` or an `&mut
T`). This causes both safety errors and unexpected behavior. The safety
errors result from regionck not being prepared for auto-ref-ref-like
adjustments; this is worth fixing on its own, but I think the best way
to do it is to modify regionck to use expr-use-visitor (and fix
expr-use-visitor as well, which I don't think properly invokes `borrow`
for each level of auto-ref), and for now it's simpler to just not
produce the adjustment in question. (I have a separate patch porting
regionck to use exprusevisitor for a different bug, so that is coming.)
Fix an incorrect type annotation (shadowed lifetime parameter) that was masked by
these bugs.
Fix ICE when a struct variant enum is imported from an external crate

Fixes the first case of #19340.
Fix ICE when a struct variant enum contains multiple fields

Fixes the second case of #19340.
Add an implementation of the BitOps for BTreeSets.

Add initial attempt at implementing BitOr for BTreeSet.

Update the implementation of the bitor operator for BTreeSets.

`make check` ran fine through this.

Add implementations for BitAnd, BitXor, and Sub as well.

Remove the FIXME comment and add unstable flags.

Add doctests for the bitop functions.
auto merge of #19514 : jbranchaud/rust/add-btree-set-bitor, r=Gankro

I am trying to add an implementation of `bitor` for `BTreeSet`. I think I am most of the way there, but I am going to need some guidance to take it all the way.

When I run `make check`, I get:

```
error: cannot move out of dereference of `&`-pointer
self.union(_rhs).map(|&i| i).collect::<BTreeSet<T>>()
                      ^~
```

I'd appreciate any nudges in the right direction. If I can figure this one out, I am sure I will be able to implement `bitand`, `bitxor`, and `sub` as well.

/cc @Gankro 

---

**Update**

I have added implementations for `BitOr`, `BitAnd`, `BitXor`, and `Sub` for `BTreeSet`.
auto merge of #19568 : barosl/rust/enum-struct-variants-ice, r=alexcrichton

This pull request tries to fix #19340, which states two ICE cases related to enum struct variants.

It is my first attempt to fix the compiler. I found this solution by trial and error, so the method used to fix the issue looks very hacky. Please review it, and direct me to find a better solution.

I'm also to add test cases. Where should I put them? Maybe `src/test/run-pass/issue-19340.rs`?
Slimmify BTree by replacing its internal Node type, which previously…held three separately allocated `Vec`s, with a manually allocated buffer. Additionally, restructure the node and stack interfaces to be safer and require fewer bounds checks.

Before:
test btree::map::bench::find_rand_100                      ... bench:        35 ns/iter (+/- 2)
test btree::map::bench::find_rand_10_000                   ... bench:        88 ns/iter (+/- 3)
test btree::map::bench::find_seq_100                       ... bench:        36 ns/iter (+/- 1)
test btree::map::bench::find_seq_10_000                    ... bench:        62 ns/iter (+/- 0)
test btree::map::bench::insert_rand_100                    ... bench:       157 ns/iter (+/- 8)
test btree::map::bench::insert_rand_10_000                 ... bench:       413 ns/iter (+/- 8)
test btree::map::bench::insert_seq_100                     ... bench:       272 ns/iter (+/- 10)
test btree::map::bench::insert_seq_10_000                  ... bench:       369 ns/iter (+/- 19)
test btree::map::bench::iter_1000                          ... bench:     19049 ns/iter (+/- 740)
test btree::map::bench::iter_100000                        ... bench:   1916737 ns/iter (+/- 102250)
test btree::map::bench::iter_20                            ... bench:       424 ns/iter (+/- 40)

After:
test btree::map::bench::find_rand_100                      ... bench:         9 ns/iter (+/- 1)
test btree::map::bench::find_rand_10_000                   ... bench:         8 ns/iter (+/- 0)
test btree::map::bench::find_seq_100                       ... bench:         7 ns/iter (+/- 0)
test btree::map::bench::find_seq_10_000                    ... bench:         8 ns/iter (+/- 0)
test btree::map::bench::insert_rand_100                    ... bench:       136 ns/iter (+/- 5)
test btree::map::bench::insert_rand_10_000                 ... bench:       380 ns/iter (+/- 34)
test btree::map::bench::insert_seq_100                     ... bench:       255 ns/iter (+/- 8)
test btree::map::bench::insert_seq_10_000                  ... bench:       364 ns/iter (+/- 10)
test btree::map::bench::iter_1000                          ... bench:     19112 ns/iter (+/- 837)
test btree::map::bench::iter_100000                        ... bench:   1911961 ns/iter (+/- 33069)
test btree::map::bench::iter_20                            ... bench:       453 ns/iter (+/- 37)
auto merge of #19617 : nikomatsakis/rust/issue-19261-2, r=nrc

**First commit.** Patch up debruijn indices. Fixes #19537. 

**Second commit.** Stop reborrowing so much. Fixes #19147. Fixes #19261.

r? @nick29581
auto merge of #18028 : gereeter/rust/slimmer-btree-node, r=Gankro

...ated buffer.

Before:

    test btree::map::bench::find_rand_100                      ... bench:        29 ns/iter (+/- 2)
    test btree::map::bench::find_rand_10_000                   ... bench:        83 ns/iter (+/- 6)
    test btree::map::bench::find_seq_100                       ... bench:        30 ns/iter (+/- 1)
    test btree::map::bench::find_seq_10_000                    ... bench:        50 ns/iter (+/- 3)
    test btree::map::bench::insert_rand_100                    ... bench:       186 ns/iter (+/- 30)
    test btree::map::bench::insert_rand_10_000                 ... bench:       377 ns/iter (+/- 8)
    test btree::map::bench::insert_seq_100                     ... bench:       299 ns/iter (+/- 10)
    test btree::map::bench::insert_seq_10_000                  ... bench:       368 ns/iter (+/- 12)
    test btree::map::bench::iter_1000                          ... bench:     20956 ns/iter (+/- 479)
    test btree::map::bench::iter_100000                        ... bench:   2060899 ns/iter (+/- 44325)
    test btree::map::bench::iter_20                            ... bench:       560 ns/iter (+/- 63)

After:

    test btree::map::bench::find_rand_100                      ... bench:        28 ns/iter (+/- 2)
    test btree::map::bench::find_rand_10_000                   ... bench:        74 ns/iter (+/- 3)
    test btree::map::bench::find_seq_100                       ... bench:        31 ns/iter (+/- 0)
    test btree::map::bench::find_seq_10_000                    ... bench:        46 ns/iter (+/- 0)
    test btree::map::bench::insert_rand_100                    ... bench:       141 ns/iter (+/- 1)
    test btree::map::bench::insert_rand_10_000                 ... bench:       273 ns/iter (+/- 12)
    test btree::map::bench::insert_seq_100                     ... bench:       255 ns/iter (+/- 17)
    test btree::map::bench::insert_seq_10_000                  ... bench:       340 ns/iter (+/- 3)
    test btree::map::bench::iter_1000                          ... bench:     21193 ns/iter (+/- 1958)
    test btree::map::bench::iter_100000                        ... bench:   2203599 ns/iter (+/- 100491)
    test btree::map::bench::iter_20                            ... bench:       614 ns/iter (+/- 110)

This code could probably be a fair bit cleaner, but it works.

Part of #18009.
Remove feature gate directives for `if_let`, `while_let`, and `tuple_indexing`.