This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.
Use `String::with_capacity` in `format!`
Add an `Arguments::estimated_capacity` to estimate the length of formatted text and use it in `std::fmt::format` as the initial capacity of the buffer.
The capacity is calculated based on the literal parts of format string, see the details in the implementation.
Some benches:
```rust
empty: format!("{}", black_box(""))
literal: format!("Literal")
long: format!("Hello Hello Hello Hello, {}!", black_box("world"))
long_rev: format!("{}, hello hello hello hello!", black_box("world"))
long_rev_2: format!("{}{}, hello hello hello hello!", 1, black_box("world"))
short: format!("Hello, {}!", black_box("world"))
short_rev: format!("{}, hello!", black_box("world"))
short_rev_2: format!("{}{}, hello!", 1, black_box("world"))
surround: format!("aaaaa{}ccccc{}eeeee", black_box("bbbbb"), black_box("eeeee"))
two_spaced: format!("{} {}", black_box("bbbbb"), black_box("eeeee"))
worst_case: format!("{} a long piece...", black_box("and even longer argument. not sure why it has to be so long"))
```
```
empty 25 28 3 12.00%
literal 35 29 -6 -17.14%
long 80 46 -34 -42.50%
long_rev 79 45 -34 -43.04%
long_rev_2 111 66 -45 -40.54%
short 73 46 -27 -36.99%
short_rev 74 76 2 2.70%
short_rev_2 107 108 1 0.93%
surround 142 65 -77 -54.23%
two_spaced 111 115 4 3.60%
worst_case 89 101 12 13.48%
```
rustbuild: Build jemalloc and libbacktrace only once (take 2)
This is a rebase of https://github.com/rust-lang/rust/pull/38583 without any additions, but with implemented @alexcrichton's suggestions.
~~This includes `exists(Makefile)` => `cfg(stage0)` suggestion... but it will break cross-compilation, no? Are `libstd/liballoc_jemalloc` cross-compiled for `target != host` built during `stage0`?~~
r? @alexcrichton
Extend Cell to work with non-Copy types
I'm not sure that I did this right but all of the tests pass.
I also had to move the `new()` function so that `Cell`s with non-`Copy` `T`s could be created. That wasn't in the RFC but I assume it needed to be done?
The previous way was not friendly to incremental compilation. The new
plan is to compute, for each body, a set of trait imports used in that
body (slightly subtle: for a closure, we assign the trait imports to the
enclosing fn). Then we walk all bodies and union these sets. The reason
we do this is that we can save the individual sets in the incremental
state, and then recompute only those sets that are needed. Before we
were planning to save only the final union, but in that case if some
components are invalidated we have to recompute *all* of them since we
don't have enough information to "partly" invalidate a result.
In truth, this set probably ought to be part of the `TypeckTables`;
however, I opted not to do that because I don't want to have to
save/restore the entire tables in the incremental state yet (since it
contains a lot of `NodeId` references, and removing those is a
significant refactoring).
Although signatures with anonymous parameters may not be deprecated or
removed at this point, the team seems to agree that the ability to have
an anonymous parameter is unfortunate historical baggage, and that we
shouldn't create new code that uses it.
Context: https://github.com/rust-lang/rust/issues/33417#issuecomment-276933861