add GNU make files for arm-unknown-linux-musleabi
For Yocto (Embedded Linux meta distro) Rust is provided via the [meta-rust layer](https://github.com/meta-rust/meta-rust). In this project there have been patches to add `arm-unknown-linux-musleabi`. Rust recently acquired that support via #35060 but only for rustbuild. meta-rust is currently only able to build Rust support with the existing GNU Makefiles. This adds `arm-unknown-linux-musleabi` support to Rust for the GNU Makefiles until meta-rust is able to sort out why using rustbuild does not work for it.
/cc @srwalter @derekstraka @jmesmon @japaric
[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}.
Storage live ranges are tracked for all MIR variables and temporaries with a drop scope.
`StorageLive` is lowered to `llvm.lifetime.start` and `StorageDead` to `llvm.lifetime.end`.
There are some improvements possible here, such as:
* pack multiple storage liveness statements by using the index of first local + `u64` bitset
* enforce that locals are not directly accessed outside their storage live range
* shrink storage live ranges for never-borrowed locals to initialization -> last use
* emit storage liveness statements for *all* temporaries
* however, the remaining ones are *always* SSA immediates, so they'd be noop in MIR trans
* could have a flag on the temporary that its storage is irrelevant (a la C's old `register`)
* would also deny borrows if necessary
* this seems like an overcompliation and with packing & optimizations it may be pointless
Even in the current state, it helps stage2 `rustc` compile `boiler` without overflowing (see #35408).
A later addition fixes#26764 and closes#27372 by emitting `.section` directives for dylib metadata to avoid them being allocated into memory or read as `.note`. For this PR, those bugs were tripping valgrind.
fix small typos in std::convert documentation
Fix subject-verb agreement in copypasta: "`AsRef` dereference" to
"`AsRef` dereferences".
Formalize "eg" to "e.g." Italicization of common Latin abbreviations
seems to be going out of style in written English, so I left it plain.
book: fix the hidden find() functions in error-handling.md
The hidden find() functions always returns None. Consequently, one of the
examples using find() prints "No file extension found" instead of
"File extension: rs" which is the expected output.
This patch fixes the issue by implementing find() with std::str::find().
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
changed E0067 to new error format
Updated E0067 to new error format.
Part of #35233Fixes#35502
Passes all the tests when running:
`python src/bootstrap/bootstrap.py --step check-cfail --stage 1`
**This seems strange, given that the format for E0067 has been changed.**
It feels like it should fail some unit tests maybe?
Let me know if I'm mistaken. Otherwise I can create a unit test for it.
Thanks for letting me help!
r? @jonathandturner
Improve &-ptr printing
This PR replaces printing `&-ptr` with a more readable description. To do so it uses a few heuristics.
If the name of the type is unknown, too long (longer than just saying "reference"), or too complex (a type with explicit lifetime annotations), it will instead opt to print either "reference" or "mutable reference", depending on the mutability of the type.
Before:
```
error[E0308]: mismatched types
--> src/test/compile-fail/issue-7061.rs:14:46
|
14 | fn foo(&'a mut self) -> Box<BarStruct> { self }
| ^^^^ expected box, found &-ptr
|
= note: expected type `Box<BarStruct>`
= note: found type `&'a mut BarStruct`
error: aborting due to previous error
```
After:
```
error[E0308]: mismatched types
--> src/test/compile-fail/issue-7061.rs:14:46
|
14 | fn foo(&'a mut self) -> Box<BarStruct> { self }
| ^^^^ expected box, found mutable reference
|
= note: expected type `Box<BarStruct>`
= note: found type `&'a mut BarStruct`
error: aborting due to previous error
```
Use an existing constant name as an example.
By reading atomics documentation I tried to use `INIT_ATOMIC_BOOL`, which I couldn't find. Turns out it was renamed to `ATOMIC_BOOL_INIT`.
E0248, E0267 & E0268 Change into issue format
r? @jonathandturner Part of #35391, #35519 and #35520. I have squashed all changes into a single commit. Please review the changes.
E0248 Change in issue format
E0267 UT New Format
E0268 UT New Format
E0267 & E0268 New Error Format
add -mrelax-relocations=no to i686-musl and i586-gnu
I've been experiencing #34978 with these two targets. This applies the
hack in #35178 to these targets as well.
r? @alexcrichton
Emscripten test fixes
This picks up parts of #31623 to disable certain tests that emscripten can't run, as threads/processes are not supported.
I re-applied @tomaka's changes manually, I can rebase those commits with his credentials if he wants.
It also disables jemalloc for emscripten (at least in Rustbuild, I have to check if there is another setting for the same thing in the old makefile approach).
This should not impact anything for normal builds.
Update E0138 to new format
Part of #35233Fix#35510
r? @jonathandturner
![e0138](https://cloud.githubusercontent.com/assets/2716047/17562415/7200d93c-5f5d-11e6-98ff-e15c29f40e03.png)
Question: How can I only underline the function name ? I have observed the debug output and the struct of item, but I can't find the `Span` for function name. Should I modify the struct I get to save function name's position or there is another way to get it ? (I can only find `Span`s for function attributes, inputs, outputs, blocks)
Implemented a smarter TokenStream concatenation system
The new algorithm performs 'aggressive compacting' during concatenation as follows:
- If the nodes' combined total total length is less than 32, we copy both of
them into a new vector and build a new leaf node.
- If one node is an internal node and the other is a 'small' leaf (length<32),
we recur down the internal node on the appropriate side.
- Otherwise, we construct a new internal node that points to them as left and
right.
This should produce notably better behavior than the current concatenation implementation.
std: Optimize panic::catch_unwind slightly
The previous implementation of this function was overly conservative with
liberal usage of `Option` and `.unwrap()` which in theory never triggers. This
commit essentially removes the `Option`s in favor of unsafe implementations,
improving the code generation of the fast path for LLVM to see through what's
happening more clearly.
cc #34727
Produce source package in rust-installer format
See rust-lang/rust-buildbot#102
There may be a better way to do this, wasn't sure how to clean-up the `rust-src-image` directory when it's used by multiple make rules.
macros: Make metavariables hygienic
This PR makes metavariables hygienic. For example, consider:
```rust
macro_rules! foo {
($x:tt) => { // Suppose that this token tree argument is always a metavariable.
macro_rules! bar { ($x:expr, $y:expr) => { ($x, $y) } }
}
}
fn main() {
foo!($z); // This currently compiles.
foo!($y); // This is an error today but compiles after this PR.
}
```
Today, the `macro_rules! bar { ... }` definition is only valid when the metavariable passed to `foo` is not `$y` (since it unhygienically conflicts with the `$y` in the definition of `bar`) or `$x` (c.f. #35450).
After this PR, the definition of `bar` is always valid (and `bar!(a, b)` always expands to `(a, b)` as expected).
This can break code that was allowed in #34925 (landed two weeks ago). For example,
```rust
macro_rules! outer {
($t:tt) => {
macro_rules! inner { ($i:item) => { $t } }
}
}
outer!($i); // This `$i` should not interact with the `$i` in the definition of `inner!`.
inner!(fn main() {}); // After this PR, this is an error ("unknown macro variable `i`").
```
Due to the severe limitations on nested `macro_rules!` before #34925, this is not a breaking change for stable/beta.
Fixes#35450.
r? @nrc
Add --test-threads option to test binaries
This change allows parallelism of test runs to be specified by a
command line flag names --test-threads in addition to the existing
environment variable RUST_TEST_THREADS. Fixes#25636.
[MIR] Add explicit SetDiscriminant StatementKind for deaggregating enums
cc #35186
To deaggregate enums, we need to be able to explicitly set the discriminant. This PR implements a new StatementKind that does that.
I think some of the places that have `panics!` now could maybe do something smarter.