`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.
This is a quick fix that prevents an ICE by mimicing the visitor
glue for boxed closures and bare functions. Ideally, the `TyVisitor`
interface will be improved in the future to allow representing
more information about unboxed closures such as Fn/FnMut/FnOnce
status, capture mode, and captured free variable types and offsets.
Closes issue #17737
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.
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.
Store references to the freevars instead of copies when constructing
the environment and insert an additional load when reading them from
the environment.
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.
This rewrites them to the current `ItemStatic` production of the compiler, but I
want to get this into a snapshot. It will be illegal to use a `static` in a
pattern of a `match` statement, so all those current uses will need to be
rewritten to `const` once it's implemented. This requires that the stage0
snapshot is able to parse `const`.
cc #17718
This PR reverts https://github.com/rust-lang/rust/pull/17620, which caused a significant regression for slices.
As discussed with @alexcrichton, all of the public-facing changes of the earlier PR need to be rolled back, and it's not clear that we should move the libraries over to this new notation yet anyway (especially given its feature-gated status).
Closes#17710
Instead, only run `make tidy`. The tidy script can run quite quickly, and it's
super annoying to run tests for 50 minutes only to have bors fail with a
"trailing whitespace" error.