Fix missing entries in upvar borrows map for capture-by-ref unboxed closures

This prevents a later ICE in borrowck.

Closes issue #17655
Fix categorization of upvars of capture-by-reference unboxed closures

In particular, this causes mutation of an upvar to correctly mark
it as mutable during adjustment.  This makes borrowck correctly
flag conflicting borrows, etc.

We still seem to generate incorrect code in trans which copies the upvar
by value into the closure.  This remains to be fixed.
Return correct types for capture-by-ref unboxed closure upvars

Treat upvars of capture-by-reference unboxed closures as references
with appropriate regions and mutability.
Correctly trans capture-by-ref unboxed closures

Store references to the freevars instead of copies when constructing
the environment and insert an additional load when reading them from
the environment.
Rehabilitate an unboxed closure test

This test works as a regression test for issue #17655.  It also
exercises mutation of by-ref upvars.
Add some more test coverage of by-ref unboxed closures
Update signature of try_recv()
Fixes spacing
Adds trailing comma
Fixes output
Use similar syntax in all arms

See issue #17672. This was started in commit ee1cbb9c71bfab8500dfabedb35ba63dd1e5b7ff, but there were a few more lines to update.
Adds missing cd
Removes extra .
Fixes wording
Fix preallocation amount in String::from_utf16

`v.len()` counts code units, not UTF-16 bytes. The lower bound is one UTF-8 byte per code unit, not per two code units.
Adds comma

Oddly (to me), this code runs fine without the comma separating the `Some` and `None` arms of the `match` construct. It seems like Rust doesn't require you to separate arms with commas if all the expressions are enclosed in braces.
auto merge of #17743 : steveklabnik/rust/receiver_fix, r=alexcrichton
test: Fix a test that fails when cross compiling

Hopefully unblocks a snapshot
auto merge of #17731 : bkoropoff/rust/unboxed-by-ref, r=pcwalton

This began as an attempt to fix an ICE in borrowck (issue #17655), but the rabbit hole went pretty deep.  I ended up plumbing support for capture-by-reference unboxed closures all the way into trans.

Closes issue #17655.
auto merge of #17752 : SimonSapin/rust/patch-6, r=thestinger

`v.len()` counts code units, not UTF-16 bytes. The lower bound is one UTF-8 byte per code unit, not per two code units.

I believe this is correct, but it’s late. Someone please double check.