compiletest: Run revisions as independent tests.
Fixes#47604.
- The output of each test is now in its own directory.
- "auxiliary" output is now under the respective test directory.
- `stage_id` removed from filenames, and instead placed in the stamp file as a hash. This helps keep path lengths down for Windows.
In brief, the new layout looks like this:
```
<build_base>/<relative_dir>/<testname>.<revision>.<mode>/
stamp
<testname>.err
<testname>.out
a (binary)
auxiliary/lib<auxname>.dylib
auxiliary/<auxname>/<auxname>.err
auxiliary/<auxname>/<auxname>.out
```
(revision and mode are optional)
- The output of each test is now in its own directory.
- "auxiliary" output is now under the respective test directory.
- `stage_id` removed from filenames, and instead placed in the stamp file as a hash. This helps keep path lengths down for Windows.
In brief, the new layout looks like this:
```
<build_base>/<relative_dir>/<testname>.<revision>.<mode>/
stamp
<testname>.err
<testname>.out
a (binary)
auxiliary/lib<auxname>.dylib
auxiliary/<auxname>/<auxname>.err
auxiliary/<auxname>/<auxname>.out
```
(revision and mode are optional)
rustc: Fix `crate` lint for single-item paths
This commit fixes recommending the `crate` prefix when migrating to 2018 for
paths that look like `use foo;` or `use {bar, baz}`
Closes#50660
Rollup of 17 pull requests
Successful merges:
- #50170 (Implement From for more types on Cow)
- #50638 (Don't unconditionally set CLOEXEC twice on every fd we open on Linux)
- #50656 (Fix `fn main() -> impl Trait` for non-`Termination` trait)
- #50669 (rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`)
- #50726 (read2: Use inner function instead of closure)
- #50728 (Fix rustdoc panic with `impl Trait` in type parameters)
- #50736 (env: remove unwrap in examples in favor of try op)
- #50740 (Remove LazyBTreeMap.)
- #50752 (Add missing error codes in libsyntax-ext asm)
- #50779 (Make mutable_noalias and arg_align_attributes be tracked)
- #50787 (Fix run-make wasm tests)
- #50788 (Fix an ICE when casting a nonexistent const)
- #50789 (Ensure libraries built in stage0 have unique metadata)
- #50793 (tidy: Add a check for empty UI test files)
- #50797 (fix a typo in signed-integer::from_str_radix())
- #50808 (Stabilize num::NonZeroU*)
- #50809 (GitHub: Stop treating Cargo.lock as a generated file.)
Failed merges:
This patch changes `opt_normalize_project_type` so it appends
obligations to a given obligations vector, instead of returning a new
obligations vector.
This change avoids lots of allocations. In the most extreme case, for a
clean "Check" build of serde it reduces the total number of allocations
by 20%.
There is a hot path through `opt_normalize_projection_type`:
- `try_start` does a cache lookup (#1).
- The result is a `NormalizedTy`.
- There are no unresolved type vars, so we call `complete`.
- `complete` does *another* cache lookup (#2), then calls
`SnapshotMap::insert`.
- `insert` does *another* cache lookup (#3), inserting the same value
that's already in the cache.
This patch optimizes this hot path by introducing `complete_normalized`,
for use when the value is known in advance to be a `NormalizedTy`. It
always avoids lookup #2. Furthermore, if the `NormalizedTy`'s
obligations are empty (the common case), we know that lookup #3 would be
a no-op, so we avoid it, while inserting a Noop into the `SnapshotMap`'s
undo log.
Implement From for more types on Cow
This is basically https://github.com/rust-lang/rust/pull/48191, except that it should be implemented in a way that doesn't break third party crates.
tidy: Add a check for empty UI test files
Check for empty `.stderr` and `.stdout` files in UI test directories.
Empty files could still pass testing for `compile-pass` tests with no output
so they can get into the repo accidentally, but they are not necessary and can
be removed.
This is very much an in progress pull request. I'm having an issue with rustfmt. It wanted to reformat the entire file for almost every file by default. And when I run tidy it just errors out because it catches the empty files that are already in the repo.
My next step is goin got be to remove those empty file and see if running tidy again will actually reformat things outside of the context of `cargo fmt`
Fixes https://github.com/rust-lang/rust/issues/50785
Ensure libraries built in stage0 have unique metadata
Issue #50786 shows a case with local rebuild where the libraries built
by stage0 had the same suffix as stage0's own, and were accidentally
loaded by that stage0 rustc when compiling `librustc_trans`.
Now we set `__CARGO_DEFAULT_LIB_METADATA` to "bootstrap" during stage0,
rather than the release channel like usual, so the library suffix will
always be completely distinct from the stage0 compiler.
Remove LazyBTreeMap.
It was introduced in #50240 to avoid an allocation when creating a new
BTreeMap, which gave some speed-ups. But then #50352 made that the
default behaviour for BTreeMap, so LazyBTreeMap is no longer necessary.
Fix rustdoc panic with `impl Trait` in type parameters
Fixes#50702.
I'm not sure `impl Trait`s neither in arguments nor in return types are supposed to work, though.
read2: Use inner function instead of closure
Very minor thing, but there doesn't appear to be a reason to use a closure here.
Generated code is identical in my tests, but I believe it's clearer that nothing from the environment is being used.
Check for empty `.stderr` and `.stdout` files in UI test directories.
Empty files could still pass testing for `compile-pass` tests with no output
so they can get into the repo accidentally, but they are not necessary and can
be removed.
Reenable the MergeFunctions pass
The crash that happened in #23566 doesn't happen anymore with the LLVM mergefunc
pass enabled and it hugely reduces code size (for example it shaves off 10% of the
final Servo executable). This patch reenables it.
For those wondering, [here are the docs from LLVM about this pass](http://llvm.org/docs/MergeFunctions.html).
rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`
Closes https://github.com/rust-lang/rust/issues/48164
Blocked on https://github.com/rust-lang/rust/pull/50541 - this includes those changes, which were necessary to create the UI test
cc https://github.com/rust-lang/rust/issues/44136
Turns out, there were special attributes to mess with rustdoc passes and plugins! Who knew! Since we deprecated the CLI flags for this functionality, it makes sense that we do the same for the attributes.
This PR also introduces a `#![doc(document_private_items)]` attribute, to match the `--document-private-items` flag introduced in https://github.com/rust-lang/rust/pull/44138 when the passes/plugins flags were deprecated.
I haven't done a search to see whether these attributes are being used at all, but if the flags were any indication, i don't expect to see any users of these.
Fix `fn main() -> impl Trait` for non-`Termination` trait
Fixes#50595.
This bug currently affects stable. Why I think we can go for hard error:
- It will in stable for at most one cycle and there is no legitimate reason to abuse it, nor any known uses in the wild.
- It only affects `bin` crates (which have a `main`), so there is little practical difference between a hard error or a deny lint, both are a one line fix.
The fix was to just unshadow a variable. Thanks @nikomatsakis for the mentoring!
r? @nikomatsakis
Don't unconditionally set CLOEXEC twice on every fd we open on Linux
Previously, every `open64` was accompanied by a `ioctl(…, FIOCLEX)`,
because some old Linux version would ignore the `O_CLOEXEC` flag we pass
to the `open64` function.
Now, we check whether the `CLOEXEC` flag is set on the first file we
open – if it is, we won't do extra syscalls for every opened file. If it
is not set, we fall back to the old behavior of unconditionally calling
`ioctl(…, FIOCLEX)` on newly opened files.
On old Linuxes, this amounts to one extra syscall per process, namely
the `fcntl(…, F_GETFD)` call to check the `CLOEXEC` flag.
On new Linuxes, this reduces the number of syscalls per opened file by
one, except for the first file, where it does the same number of
syscalls as before (`fcntl(…, F_GETFD)` to check the flag instead of
`ioctl(…, FIOCLEX)` to set it).