Closes#17075
I don't know if this is correct. The easiest way to find out is to run the following program on all targets but I can't do it myself.
```c
#include <stdint.h>
#include <stdio.h>
int main(void)
{
if (sizeof(intmax_t) != 8) {
puts("ERROR");
return 1;
}
}
```
Old vs. New vs. Vec::push_all
```
test slice ... bench: 3091942 ns/iter (+/- 54460)
test slice_new ... bench: 1800065 ns/iter (+/- 69513)
test vec ... bench: 1804805 ns/iter (+/- 75609)
```
This in theory enables uncommenting IndexMut implementations, but upon doing so
the compiler immediately segfaulted in stage1, so I'll leave those to a later
time.
This reverts commit a0ec902e23 "Avoid
unnecessary temporary on assignments".
Leaving out the temporary for the functions return value can lead to a
situation that conflicts with rust's aliasing rules.
Given this:
````rust
fn func(f: &mut Foo) -> Foo { /* ... */ }
fn bar() {
let mut foo = Foo { /* ... */ };
foo = func(&mut foo);
}
````
We effectively get two mutable references to the same variable `foo` at
the same time. One for the parameter `f`, and one for the hidden
out-pointer. So we can't just `trans_into` the destination directly, but
must use `trans` to get a new temporary slot from which the result can
be copied.
This patch contains a fix for:
- single quote around string slice
- string: String is confusing for newbies and it's more readble if the
argument name is different that the argument type name
The variable name <code>one_to_one_hundred</code> implies that it will contain a collection with the values from 1 to 100, but the collection contains the values from 0 to 99. This patch changes the ranges to produce a collection with the values from 1 to 100.
Enable parallel codegen (2 units) by default when --opt-level is 0 or 1. This
gives a minor speedup on large crates (~10%), with only a tiny slowdown (~2%)
for small ones (which usually build in under a second regardless). The current
default (no parallelization) is used when the user requests optimization
(--opt-level 2 or 3), and when the user has enabled LTO (which is incompatible
with parallel codegen).
This commit also changes the rust build system to use parallel codegen
when appropriate. This means codegen-units=4 for stage0 always, and
also for stage1 and stage2 when configured with --disable-optimize.
(Other settings use codegen-units=1 for stage1 and stage2, to get
maximum performance for release binaries.) The build system also sets
codegen-units=1 for compiletest tests (compiletest does its own
parallelization) and uses the same setting as stage2 for crate tests.
r? @aturon