This commit changes the behavior of Formatter::debug_struct,
debug_tuple, debug_list, debug_set, and debug_map to render trailing
commas in {:#?} mode, which is the dominant style in modern Rust code.
Before:
Language {
name: "Rust",
trailing_commas: false
}
After:
Language {
name: "Rust",
trailing_commas: true,
}
This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:
* Reports E0373: "closure may outlive the current function" with NLL.
* Special cases the case of returning a reference to (or value
referencing) a local variable or temporary (E0515).
* Special case assigning a reference to a local variable in a closure
to a captured variable.
Rollup of 16 pull requests
Successful merges:
- #52558 (Add tests for ICEs which no longer repro)
- #52610 (Clarify what a task is)
- #52617 (Don't match on region kinds when reporting NLL errors)
- #52635 (Fix #[linkage] propagation though generic functions)
- #52647 (Suggest to take and ignore args while closure args count mismatching)
- #52649 (Point spans to inner elements of format strings)
- #52654 (Format linker args in a way that works for gcc and ld)
- #52667 (update the stdsimd submodule)
- #52674 (Impl Executor for Box<E: Executor>)
- #52690 (ARM: expose `rclass` and `dsp` target features)
- #52692 (Improve readability in a few sorts)
- #52695 (Hide some lints which are not quite right the way they are reported to the user)
- #52718 (State default capacity for BufReader/BufWriter)
- #52721 (std::ops::Try impl for std::task::Poll)
- #52723 (rustc: Register crates under their real names)
- #52734 (sparc ABI issue - structure returning from function is returned in 64bit registers (with tests))
Failed merges:
- #52678 ([NLL] Use better spans in some errors)
r? @ghost
The strategy is this:
- we compute SCCs once all outlives constraints are known
- we allocate a set of values **per region** for storing liveness
- we allocate a set of values **per SCC** for storing the final values
- when we add a liveness constraint to the region R, we also add it
to the final value of the SCC to which R belongs
- then we can apply the constraints by just walking the DAG for the
SCCs and union'ing the children (which have their liveness
constraints within)
There are a few intermediate refactorings that I really ought to have
broken out into their own commits:
- reverse the constraint graph so that `R1: R2` means `R1 -> R2` and
not `R2 -> R1`. This fits better with the SCC computation and new
style of inference (`->` now means "take value from" and not "push
value into")
- this does affect some of the UI tests, since they traverse the
graph, but mostly the artificial ones and they don't necessarily
seem worse
- put some things (constraint set, etc) into `Rc`. This lets us root
them to permit mutation and iteration. It also guarantees they don't
change, which is critical to the correctness of the algorithm.
- Generalize various helpers that previously operated only on points
to work on any sort of region element.
nll part 5
Next round of changes from the nll-master branch.
Extensions:
- we now propagate ty-region-outlives constraints out of closures and into their creator when necessary
- we fix a few ICEs that can occur by doing liveness analysis (and the resulting normalization) during type-checking
- we handle the implicit region bound that assumes that each type `T` outlives the fn body
- we handle normalization of inputs/outputs in fn signatures
Not included in this PR (will come next):
- handling `impl Trait`
- tracking causal information
- extended errors
r? @arielb1
Before, we would always have a `Some` ClosureRegionRequirements if we
were inferring values for a closure. Now we only do is it has a
non-empty set of outlives requirements.