Setting up a cross compilation toolchain for CloudABI is relatively
easy. It's just a matter of installing a somewhat recent version of
Clang (5.0 preferred) and installing the corresponding
${target}-cxx-runtime package, containing a set of core C/C++ libraries
(libc, libc++, libunwind, etc).
Eventually it would be nice if we could also run 'x.py test'. That,
however still requires some more work. Both libtest and compiletest
would need to be adjusted to deal with CloudABI's requirement of having
all of an application's dependencies injected. Let's settle for just
doing 'x.py dist' for now.
The function parse_cfg_prefix() is not really parsing. It's just checking
whether the prefix is present or not. So the new function name as suggested by
@Mark-Simulacrum is better.
Previous patch introduced something like if x {true} else {false} which can be
simply replaced by returning x here.
Thanks to @kennytm for spotting it.
This patch implements "only-<platforms>" for tests headers using which one can
specify just the platforms on which the test should run rather than listing all
the platforms to ignore using "ignore-<platforms>".
This is a fix for issues #33581 and #47459.
The incompetent fool who added these suggestions in 38e5a964f2 apparently
thought it was safe to assume that, because the offending function or
static was unreachable, it would therefore have not have any existing
visibility modifiers, making it safe for us to unconditionally suggest
inserting `pub`. This isn't true.
This resolves#47383.
rustc_trans: reorganize CrateContext and rename context types.
Firstly, the `{Shared,Local}CrateContext` hasn't been meaningful for a while now, and this PR resolves it by moving all their fields to `CrateContext` and removing redundant accessor methods.
Secondly, this PR contains the following mass-renames:
* `ccx: CrateContext` -> `cx: CodegenCx`
* `mircx: MirContext` -> `fx: FunctionCx`
* `bcx: Builder` -> `bx: Builder`
r? @nikomatsakis
Avoid overlapping spans by only pointing at the arguments that are not
being used in the argument string. Enable libsyntax to have diagnostics
with multiple primary spans by accepting `Into<MultiSpan>` instead of
`Span`.
These are already removed in the normal optimization pipeline - so this
should slightly improve codegen performance, as these cleanup blocks are
known to hurt LLVM.
This un-regresses and is therefore a fix for #47442. However, the
reporter of that issue should try using `-C panic=abort` instead of
carefully avoiding panics.
Remove leftover Rand stuff
The in-tree version of `rand` was removed in 6bc8f164b0, but for some reason this lone file avoided the purge. Figured it's about time to finish the job. 😈
Make ui-fulldeps/update-references executable
When a ui-fulldeps comparison fails it suggests running update-references.sh:
```
src/test/ui-fulldeps/update-references.sh 'rust/build/x86_64-apple-darwin/test/ui-fulldeps' 'resolve-error.rs'
```
This does not work as update-references.sh isn't executable. The other update-references.sh in the ui directory is already executable so this looks like an oversight.
doc: show that `f32::log` and `f64::log` are not correctly rounded
Fixes#47273.
One thing I'm not sure about is whether the "calculated as `self.ln() / base.ln()`" bit is being too specific, maybe we do not want to make this such a strong commitment. I think it's fine, but we should not make commitments in the API documentation by accident.
In case that is removed, the added sentence "`self.log2()` can ... base 10." still makes it amply clear that the `log` methods can be more inaccurate than other methods. If the above clause is removed, this second sentence can be moved to the first paragraph, kind of like the accuracy comment for the [`mul_add`](https://doc.rust-lang.org/std/primitive.f32.html#method.mul_add) method.
Add slice::ExactChunks and ::ExactChunksMut iterators
These guarantee that always the requested slice size will be returned
and any leftoever elements at the end will be ignored. It allows llvm to
get rid of bounds checks in the code using the iterator.
This is inspired by the same iterators provided by ndarray.
Fixes https://github.com/rust-lang/rust/issues/47115
I'll add unit tests for all this if the general idea and behaviour makes sense for everybody.
Also see https://github.com/rust-lang/rust/issues/47115#issuecomment-354715511 for an example what this improves.
Better Debug impl for io::Error.
This PR includes the below changes:
1. The former impl wrapped the entire thing in `Error { repr: ... }` which was unhelpful; this has been removed.
2. The `Os` variant of `io::Error` included the code and message, but not the kind; this has been fixed.
3. The `Custom` variant of `io::Error` included a `Custom(Custom { ... })`, which is now just `Custom { ... }`.
Example of previous impl:
```rust
Error {
repr: Custom(
Custom {
kind: InvalidData,
error: Error {
repr: Os {
code: 2,
message: "no such file or directory"
}
}
}
)
}
```
Example of new impl:
```rust
Custom {
kind: InvalidData,
error: Os {
code: 2,
kind: NotFound,
message: "no such file or directory"
}
}
```
When we suggest the replacement for a macro we include the "!" in the
suggested replacement but the span only contains the name of the macro
itself. Using that replacement would cause a duplicate "!" in the
resulting code.
I originally tried to extend the span to be replaced by 1 byte in
rust-lang/rust#47424. However, @zackmdavis pointed out that there can be
whitespace between the macro name and the bang.
Instead, just remove the bang from the suggested replacement.
Fixes#47418
When a ui-fulldeps comparison fails it suggests running
update-references.sh:
```
src/test/ui-fulldeps/update-references.sh 'rust/build/x86_64-apple-darwin/test/ui-fulldeps' 'resolve-error.rs'
```
This does not work as update-references.sh isn't executable. The other
update-references.sh in the ui directory is already executable so this looks
like an oversight.