Instead of checking patterns in a top-down fashion with a known
expected type on entry, this changes makes typeck establish
appropriate constraints between a pattern and the expression
it destructures, and lets inference compute the final types
or produce good error messages if it's impossible.
This installs signal handlers to print out stack overflow messages on Linux. It also ensures the main thread has a guard page.
This will catch stack overflows in external code. It's done in preparation of switching to stack probes (#16012).
I've done some simple tests with overflowing the main thread, native threads and green threads (with and without UV) on x86-64.
This might work on ARM, MIPS and x86-32.
I've been unable to run the test suite on this because of #16305.
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.