Add suggestions for misspelled method names
Use the syntax::util::lev_distance module to provide suggestions when a
named method cannot be found.
Part of #30197
Require rlibs for dependent crates when linking static executables
This handles the case for `CrateTypeExecutable` and `+crt_static`. I reworked the match block to avoid duplicating the `attempt_static` and error checking code again (this case would have been a copy of the `CrateTypeCdylib`/`CrateTypeStaticlib` case).
On `linux-musl` targets where `std` was built with `crt_static = false` in `config.toml`, this change brings the test suite from entirely failing to mostly passing.
This change should not affect behavior for other crate types, or for targets which do not respect `+crt_static`.
Allow writing metadata without llvm
# Todo:
* [x] Rebase
* [x] Fix eventual errors
* [x] <strike>Find some crate to write elf files</strike> (will do it later)
Cc #43842
No other iterator makes the distinction between an iterator and an iterator adapter
in its summary line, so change it to be consistent with all other adapters.
encode region::Scope using fewer bytes
Now that region::Scope is no longer interned, its size is more important. This PR encodes region::Scope in 8 bytes instead of 12, which should speed up region inference somewhat (perf testing needed) and should improve the margins on #36799 by 64MB (that's not a lot, I did this PR mostly to speed up region inference).
This is a perf-sensitive PR. Please don't roll me up.
r? @eddyb
This is based on #44743 so I could get more accurate measurements on #36799.
In particular:
* introduce the shallow/deep distinction for read/write accesses
* use the notions of prefixes, shallow prefixes, and supporting prefixes
rather than trying to recreate the restricted sets from ast-borrowck.
* Add shallow reads of Discriminant and ArrayLength, and treat them
as artificial fields when doing prefix traversals.
This is a partial revert of #42588. There is a usability concern
reported in #44294 that was not considered in the discussion of the PR,
so I would like to back this out of 1.21. As is, I think users would
have a worse and more confusing experience with this lint enabled by
default. We can re-enabled once there are better diagnostics or the case
in #44294 does not trigger the lint.
* Adjust bootstrap to provide useful output on failure
* Add missing package dependencies in the build environment
* Fix permission bits on prebuilt toolchain files
Move effect-checking to MIR
This allows emitting lints from MIR and moves the effect-checking pass to work on it.
I'll make `repr(packed)` misuse unsafe in a separate PR.
r? @eddyb
put empty generic lists behind a pointer
This reduces the size of hir::Expr from 128 to 88 bytes (!) and shaves
200MB out of #36799.
This is a performance-sensitive PR so please don't roll it up.
r? @eddyb
On "the parameter type `T` may not live long enough" error, point to the
parameter type suggesting lifetime bindings:
```
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
|
27 | struct Foo<T> {
| - help: consider adding an explicit lifetime bound `T: 'static`...
28 | foo: &'static T
| ^^^^^^^^^^^^^^^
|
note: ...so that the reference type `&'static T` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
|
28 | foo: &'static T
| ^^^^^^^^^^^^^^^
```
The convention for suggesting close matches is to provide at most one match (the
closest one). Change the suggestions for misspelt method names to obey that.
typeck::check::coercion - roll back failed unsizing type vars
This wraps unsizing coercions within an additional level of
`commit_if_ok`, which rolls back type variables if the unsizing coercion
fails. This prevents a large amount of type-variables from accumulating
while type-checking a large function, e.g. shaving 2GB off one of the
4GB peaks in #36799.
This is a performance-sensitive PR so please don't roll it up.
r? @eddyb
cc @nikomatsakis
Now that region::Scope is no longer interned, its size is more
important. This PR encodes region::Scope in 8 bytes instead of 12, which
should speed up region inference somewhat (perf testing needed) and
should improve the margins on #36799 by 64MB (that's not a lot, I did
this PR mostly to speed up region inference).