Add a Docker container for doing automated builds for CloudABI.
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.
Add a default directory for -Zmir-dump-dir
The current behaviour of dumping in the current directory is rarely
desirable: a sensible default directory for dumping is much more
convenient. This makes sets the default value for `-Zmir-dump-dir`
to `mir_dump/`.
r? @eddyb
fix mispositioned span
This fixes#47377
The output now looks like this
```
error[E0369]: binary operation `+` cannot be applied to type `&str`
--> h.rs:3:11
|
3 | let _a = b + ", World!";
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
3 | let _a = b.to_owned() + ", World!";
| ^^^^^^^^^
error: aborting due to previous error
```
For the case when emojis are involved, it gives the new output for proper indentation.
But for an indentation as follows,
```
fn main() {
let b = "hello";
let _a = b + ", World!";
}
```
it still mispositions the span
```
3 | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
|
3 | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";
| ^^^^^^^
error: aborting due to previous erro
```
cc @estebank @est31
Standardize on "re-export" rather than "reexport"
While working on the book with our editors, it was brought to our attention that we're not consistent with when we use "re-export" versus "reexport". For the book, we've decided (with our editors) to go with "re-export"; in prose, I think that looks better. In code, I'm fine with "reexport".
However, the rustdoc generated section is currently "Reexports", so when we have a screenshot of generated documentation with the prose where we use "re-export", it's inconsistent.
It's too late to fix this for the book because we're using 1.21.0 for the output in the book, and it's really only one spot so it's not a huge deal, but I'd like to advocate for changing the documentation header so that a future edition of the book can be consistent.
The first commit here only changes the documentation section heading text and rustdoc documentation that references it. This is the commit that's most important to me.
The second commit changes error messages and associated tests to also be consistent with the use of re-export. This is the next most important commit to me, but I could be argued out of this one because then it won't match code like the `macro_reexports` feature name, which ostensibly should change to `macro_re_exports` to be most consistent but I didn't want to change code.
The last commit changes re-export anywhere else in prose: either in documentation comments or regular comments. This is least important as most of them aren't user-visible. Instances like these will likely sneak back in over time. I'm totally fine dropping this commit if anyone wants, but [the hobgoblins made me do it](http://www.bartleby.com/100/420.47.html) and it sets a good example.
r? @steveklabnik
Report errors instead of panic!() when linkcheck encounters absolute paths
The RBE contained some absolute links that failed the link check in #46196. Diagnosing these issues was needlessly complicated, thanks to the linkchecker just panicing instead of reporting proper errors.
This PR replaces the panic with a proper `*errors = true` + error message handling.
The linkchecker itself doesn't have any tests so I intentionally didn't touch anything else than the code that previously did the `panic!()`. A small code quality improvement might be made by binding the `Path::new(base).join(url)` into a variable before the for-loop and using this resolved url in both the for loop and the error message.
r? @steveklabnik
(If not for any other reason than having r on the #46196.)
Remove dep-info files as targets in themselves
If you ask `rustc` to `--emit dep-info`, the resulting dependency file contains a rule for producing the dependency file itself. This differs from the output of `gcc -MD` or `clang -MD`, which only includes dependency rules for the object files produced.
Tools like Ninja often consume and delete dependency files as soon as they’re produced for performance reasons, particularly on Windows. In the case of `rustc` output, though, the recently-deleted dependency file is cached by Ninja as a target, and therefore triggers a rebuild every time.
This very small patch removes the dep-info file from the list of output filenames, so it matches the behavior of gcc and clang.
Pull in rust-lang/rust-installer#76 to get streamed tarball generation,
rather than batching it all in memory, while still getting the benefit
of compressing in parallel.
This fixes an accidental regression #46335 where the behavior of
`Path::ends_with` is different from `str::ends_with` (paths operate over
components, strs operate over chars).
As discussed in #47427, let's not have a separate container for doing
CloudABI builds. It's a lot faster if we integrate it into an existing
container, so there's less duplication of what's being built.
Upgrade the existing container to Ubuntu 17.10, which is required for
CloudABI builds. The version of Clang shipped with 16.04 is not recent
enough to support CloudABI properly.
The match lowering code, when lowering matches against bytestrings,
works by coercing both the scrutinee and the pattern to `&[u8]` and
then comparing them using `<[u8] as Eq>::eq`.
If the scrutinee is already of type `&[u8]`, then unsizing it is both
unneccessary and a trait error caught by the new and updated MIR typeck,
so this PR changes lowering to avoid doing that (match lowering tried to
avoid that before, but that attempt was quite broken).
Fixes#46920.
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`.