bors [Fri, 5 Feb 2021 12:11:05 +0000 (12:11 +0000)]
Auto merge of #81784 - m-ou-se:rollup-s23fow7, r=m-ou-se
Rollup of 15 pull requests
Successful merges:
- #79554 (Generic associated types in trait paths)
- #80726 (relax adt unsizing requirements)
- #81307 (Handle `Span`s for byte and raw strings and add more detail )
- #81318 (rustdoc-json: Fix has_body)
- #81456 (Make remote-test-server easier to use with new targets)
- #81497 (rustdoc: Move `display_fn` struct inside `display_fn`)
- #81500 (Remove struct_type from union output)
- #81542 (Expose correct symlink API on WASI)
- #81676 (Add more information to the error code for 'crate not found')
- #81682 (Add additional bitset benchmarks)
- #81730 (Make `Allocator` object-safe)
- #81763 (Cleanup rustdoc pass descriptions a bit)
- #81767 (Update LayoutError/LayoutErr stability attributes)
- #81771 (Indicate change in RSS from start to end of pass in time-passes output)
- #81781 (Fix `install-awscli.sh` error in CI)
Mara Bos [Fri, 5 Feb 2021 11:26:06 +0000 (12:26 +0100)]
Rollup merge of #81763 - camelid:rustdoc-passes-desc-up, r=GuillaumeGomez
Cleanup rustdoc pass descriptions a bit
Also changed a couple of comments from "intra-doc-links" to
"intra-doc links" (my understanding is that "intra-doc links" is the
standard way to refer to them).
Mara Bos [Fri, 5 Feb 2021 11:26:03 +0000 (12:26 +0100)]
Rollup merge of #81682 - JulianKnodt:bit_set_iter_benchmarks, r=oli-obk
Add additional bitset benchmarks
Add additional benchmarks for operations in bitset, I realize that it was a bit lacking when I intended to optimize it earlier, so I was hoping to put some in so I can verify my work later.
Mara Bos [Fri, 5 Feb 2021 11:26:00 +0000 (12:26 +0100)]
Rollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichton
Expose correct symlink API on WASI
As described in https://github.com/rust-lang/rust/issues/68574, the currently exposed API for symlinks is, in fact, a thin wrapper around the corresponding syscall, and not suitable for public usage.
The reason is that the 2nd param in the call is expected to be a handle of a "preopened directory" (a WASI concept for exposing dirs), and the only way to retrieve such handle right now is by tinkering with a private `__wasilibc_find_relpath` API, which is an implementation detail and definitely not something we want users to call directly.
Making matters worse, the semantics of this param aren't obvious from its name (`fd`), and easy to misinterpret, resulting in people trying to pass a handle of the target file itself (as in https://github.com/vitiral/path_abs/pull/50), which doesn't work as expected.
I did a [codesearch among open-source repos](https://sourcegraph.com/search?q=std%3A%3Aos%3A%3Awasi%3A%3Afs%3A%3Asymlink&patternType=literal), and the usage above is so far the only usage of this API at all, but we should fix it before more people start using it incorrectly.
While this is technically a breaking API change, I believe it's a justified one, as 1) it's OS-specific and 2) there was strictly no way to correctly use the previous form of the API, and if someone does use it, they're likely doing it wrong like in the example above.
The new API does not lead to the same confusion, as it mirrors `std::os::unix::fs::symlink` and `std::os::windows::fs::symlink_{file,dir}` variants by accepting source/target paths.
Mara Bos [Fri, 5 Feb 2021 11:25:59 +0000 (12:25 +0100)]
Rollup merge of #81500 - CraftSpider:union-kind, r=jyn514
Remove struct_type from union output
Also bumps the format number and adds a test
Rationale: It's illegal to have unions of the form `union Union(i32, f32);`, or `union Union;`. The struct_type field was recently removed from the rustdoc Union AST, at which time this field was changed to always just read "union". It makes sense to completely remove it, as it provides no information.
This makes it clear that it's an implementation detail of `display_fn`
and shouldn't be used elsewhere, and it enforces in the compiler that no
one else can use it.
Mara Bos [Fri, 5 Feb 2021 11:25:56 +0000 (12:25 +0100)]
Rollup merge of #81456 - Amanieu:remote-test-server, r=Amanieu
Make remote-test-server easier to use with new targets
While testing #81455 I encountered 2 issues with `remote-test-server`:
- It is built with the stage 0 toolchain, which does not support a newly added target.
- It overwrites `LD_LIBRARY_PATH` instead of appending to it, which prevents the use of a custom sysroot for target libraries.
Mara Bos [Fri, 5 Feb 2021 11:25:52 +0000 (12:25 +0100)]
Rollup merge of #80726 - lcnr:unsize-query, r=oli-obk
relax adt unsizing requirements
Changes unsizing of structs in case the last struct field shares generic params with other adt fields which do not change.
This change is currently insta stable and changes the language, so it at least requires a lang fcp. I feel like the current state is fairly unintuitive.
An example for what's now allowed would be https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6dd331d23f5c9ffc8c978175aae2e967
```rust
struct A<T, U: ?Sized>(T, B<T, U>); // previously ERR
// struct A<T, U: ?Sized>(T, B<[u32; 1], U>); // ok
struct B<T, U: ?Sized>(T, U);
fn main() {
let x = A([0; 1], B([0; 1], [0; 1]));
let y: &A<[u32; 1], [u32]> = &x;
assert_eq!(y.1.1.len(), 1);
}
```
bors [Fri, 5 Feb 2021 09:20:51 +0000 (09:20 +0000)]
Auto merge of #81736 - tgnottingham:tune-cgu-scheduling-for-memory, r=nagisa
rustc_codegen_ssa: tune codegen scheduling to reduce memory usage
For better throughput during parallel processing by LLVM, we used to sort
CGUs largest to smallest. This would lead to better thread utilization
by, for example, preventing a large CGU from being processed last and
having only one LLVM thread working while the rest remained idle.
However, this strategy would lead to high memory usage, as it meant the
LLVM-IR for all of the largest CGUs would be resident in memory at once.
Instead, we can compromise by ordering CGUs such that the largest and
smallest are first, second largest and smallest are next, etc. If there
are large size variations, this can reduce memory usage significantly.
bors [Fri, 5 Feb 2021 06:12:26 +0000 (06:12 +0000)]
Auto merge of #81688 - pnkfelix:fix-llvm-version-check-in-run-make-tests, r=simulacrum
Use `# min-llvm-version: 11.0` to force a minimum LLVM version
Use `# min-llvm-version: 11.0` to force a minimum LLVM version, rather than ad-hoc internal solution.
In particular: the specific code to define LLVM_VERSION_11_PLUS here was, for some reason, using `$(shell ...)` with bash-specific variable replacement code. On non-bash platforms like dash, that `shell` invocation would fail, and the
LLVM_VERSION_11_PLUS check would always fail, the test would always be ignored, and thus be treated as a "success" (in the sense that `--bless` would never do anything).
* Note in particular that GNU Make treats the SHELL variable as a very special case: it does not inherit the value of SHELL from the user's environment. Except on Windows. See more explanation in the [GNU Make docs](https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html).
* The effect of this is that these tests end up using `/bin/sh` (except on Windows) for their `$(shell ...)` invocations, and thus we see differing behaviors depending on whether your `/bin/sh` links to `/bin/dash` or to `/bin/bash`.
bors [Fri, 5 Feb 2021 02:13:59 +0000 (02:13 +0000)]
Auto merge of #81756 - ehuss:update-cargo, r=ehuss
Update cargo
5 commits in e099df243bb2495b9b197f79c19f124032b1e778..34170fcd6e0947808a1ac63ac85ffc0da7dace2f
2021-02-01 16:24:34 +0000 to 2021-02-04 15:52:52 +0000
- Fix permission issue with `cargo vendor`. (rust-lang/cargo#9131)
- Add split-debuginfo profile option (rust-lang/cargo#9112)
- Add RegistryBuilder for tests, and update crates-io error handling. (rust-lang/cargo#9126)
- Add some documentation for index and registry stuff. (rust-lang/cargo#9125)
- Fix env/cfg set for `cargo test` and `cargo run`. (rust-lang/cargo#9122)
bors [Thu, 4 Feb 2021 23:16:08 +0000 (23:16 +0000)]
Auto merge of #81761 - m-ou-se:rollup-xp7v07n, r=m-ou-se
Rollup of 9 pull requests
Successful merges:
- #74304 (Stabilize the Wake trait)
- #79805 (Rename Iterator::fold_first to reduce and stabilize it)
- #81556 (introduce future-compatibility warning for forbidden lint groups)
- #81645 (Add lint for `panic!(123)` which is not accepted in Rust 2021.)
- #81710 (OsStr eq_ignore_ascii_case takes arg by value)
- #81711 (add #[inline] to all the public IpAddr functions)
- #81725 (Move test to be with the others)
- #81727 (Revert stabilizing integer::BITS.)
- #81745 (Stabilize poison API of Once, rename poisoned())
Camelid [Thu, 4 Feb 2021 21:19:01 +0000 (13:19 -0800)]
Cleanup rustdoc pass descriptions a bit
Also changed a couple of comments from "intra-doc-links" to
"intra-doc links" (my understanding is that "intra-doc links" is the
standard way to refer to them).
bors [Thu, 4 Feb 2021 20:30:11 +0000 (20:30 +0000)]
Auto merge of #81762 - pietroalbini:fix-install-msys2, r=m-ou-se
CI: only copy python.exe to python3.exe if the latter does not exist
We're copying the binary to make sure we can call `python3.exe` around, but it seems like the base image of GitHub Actions changed, copying the file before we do so. This PR changes the CI script to only copy the file if it doesn't already exist.
Pietro Albini [Thu, 4 Feb 2021 20:24:41 +0000 (21:24 +0100)]
ci: only copy python.exe to python3.exe if the latter does not exist
We're copying the binary to make sure we can call python3.exe around,
but it seems like the base image of GitHub Actions changed, copying the
file before we do so.
This commit changes the CI script to only copy the file if it doesn't
already exist.
Mara Bos [Thu, 4 Feb 2021 20:10:44 +0000 (21:10 +0100)]
Rollup merge of #81745 - Kixunil:stabilize_once_poison, r=m-ou-se
Stabilize poison API of Once, rename poisoned()
This stabilizes:
* `OnceState`
* `OnceState::is_poisoned()` (previously named `poisoned()`)
* `Once::call_once_force()`
`poisoned()` was renamed because the new name is more clear as a few
people agreed and nobody objected.
Closes #33577
Notes:
* I'm not entirely sure it's supposed to be 1.51, LMK if I did it wrong
* I failed to run tests locally, so we will have to leave it to bors or someone else can try
Mara Bos [Thu, 4 Feb 2021 20:10:42 +0000 (21:10 +0100)]
Rollup merge of #81727 - m-ou-se:unstabilize-bits, r=Mark-Simulacrum
Revert stabilizing integer::BITS.
We agreed in the libs meeting just now to revert stablization, since the [breakage](https://github.com/rust-lang/rust/issues/81654) is significant throughout the ecosystem, through `lexical-core`.
Mara Bos [Thu, 4 Feb 2021 20:10:37 +0000 (21:10 +0100)]
Rollup merge of #81710 - TyPR124:patch-2, r=m-ou-se
OsStr eq_ignore_ascii_case takes arg by value
Per a comment on #70516 this changes `eq_ignore_ascii_case` to take the generic parameter `S: AsRef<OsStr>` by value instead of by reference.
This is technically a breaking change to an unstable method. I think the only way it would break is if you called this method with an explicit type parameter, ie `my_os_str.eq_ignore_ascii_case::<str>("foo")` becomes `my_os_str.eq_ignore_ascii_case::<&str>("foo")`.
Besides that, I believe it is overall more flexible since it can now take an owned `OsString` for example.
If this change should be made in some other PR (like #80193) then please just close this.
Mara Bos [Thu, 4 Feb 2021 20:10:36 +0000 (21:10 +0100)]
Rollup merge of #81645 - m-ou-se:panic-lint, r=estebank,flip1995
Add lint for `panic!(123)` which is not accepted in Rust 2021.
This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021.
It suggests to add `"{}",` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.
It renames the lint to `non_fmt_panic` to match the lint naming guidelines.
Mara Bos [Thu, 4 Feb 2021 20:10:34 +0000 (21:10 +0100)]
Rollup merge of #81556 - nikomatsakis:forbidden-lint-groups-lint, r=pnkfelix
introduce future-compatibility warning for forbidden lint groups
We used to ignore `forbid(group)` scenarios completely. This changed in #78864, but that led to a number of regressions (#80988, #81218).
This PR introduces a future compatibility warning for the case where a group is forbidden but then an individual lint within that group is allowed. We now issue a FCW when we see the "allow", but permit it to take effect.
Mara Bos [Thu, 4 Feb 2021 20:10:33 +0000 (21:10 +0100)]
Rollup merge of #79805 - m-ou-se:iterator-reduce, r=KodrAus
Rename Iterator::fold_first to reduce and stabilize it
This stabilizes `#![feature(iterator_fold_self)]`.
The name for this function (originally `fold_first`) was still an open question, but the discussion on [the tracking issue](https://github.com/rust-lang/rust/issues/68125) seems to have converged to `reduce`.
Mara Bos [Thu, 4 Feb 2021 20:10:31 +0000 (21:10 +0100)]
Rollup merge of #74304 - yoshuawuyts:stabilize-wake, r=KodrAus
Stabilize the Wake trait
This PR proposes stabilizing the `wake_trait` feature, tracking issue https://github.com/rust-lang/rust/issues/69912.
## Motivation
The surface area this trait introduces is small, and it has been on nightly for 4 months without any reported issues. Given the surface area of this trait is small and only serves to provide a safe interface around the already stable [`std::task::RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWaker.html) it seems unlikely this trait will require any further changes. So I'm proposing we stabilize this.
Personally I would love to have this available on stable, since it would enable cleaning up some runtime internals by removing the tedious pointer required to construct a [`RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWakerVTable.html). I believe the intent was always to introduce a `Wake` counterpart to `RawWaker` in order to safely construct `Waker` instances. And the `Wake` trait feels like it does that job as intended.
## Implementation notes
This PR itself fixes a link in the docs, and introduces an example of how to use the trait: a minimal `block_on` example that runs a future to completion on the current thread. It doesn't include fancier features such as support for nesting, but is intended to serve as a teaching device for both `task::Wake` and futures alike.
Eric Huss [Thu, 4 Feb 2021 17:41:15 +0000 (09:41 -0800)]
Adjust global_asm doc test to work on all platforms.
The cfg isn't actually necessary, since `--emit=metadata` does not
actually do enough validation for it to fail on any platform. However,
I feel a little more comfortable leaving it in.
Unhide the feature flag, since I think that is important to display.
rustc_codegen_ssa: tune codegen scheduling to reduce memory usage
For better throughput during parallel processing by LLVM, we used to sort
CGUs largest to smallest. This would lead to better thread utilization
by, for example, preventing a large CGU from being processed last and
having only one LLVM thread working while the rest remained idle.
However, this strategy would lead to high memory usage, as it meant the
LLVM-IR for all of the largest CGUs would be resident in memory at once.
Instead, we can compromise by ordering CGUs such that the largest and
smallest are first, second largest and smallest are next, etc. If there
are large size variations, this can reduce memory usage significantly.
Mara Bos [Mon, 1 Feb 2021 21:30:09 +0000 (22:30 +0100)]
Add lint for `panic!(123)` which is not accepted in Rust 2021.
This extends the `panic_fmt` lint to warn for all cases where the first
argument cannot be interpreted as a format string, as will happen in
Rust 2021.
It suggests to add `"{}", ` to format the message as a string. In the
case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.
It renames the lint to `non_fmt_panic` to match the lint naming
guidelines.
(Test was silently ignored on Linux CI prior to parent commit that switched to
using `# min-llvm-version`. But the switch made the ignoring stop, exposing
other brokenness in the form of bash-dependent syntax in the `$(shell ...)`
invocations.)
Mara Bos [Wed, 3 Feb 2021 17:51:17 +0000 (18:51 +0100)]
Rollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank
Reduce tab formatting assertions to debug only
The tab replacement for diagnostics added in #79757 included a few assertions to ensure all tab characters are handled appropriately. We've started getting reports of these assertions firing (#81614). Since it's only a cosmetic issue, this downgrades the assertions to debug only, so we at least continue compiling even if the diagnostics might be a tad wonky.
Before this change it would ICE. In #70998 the removed logic was added
to provide better suggestions, and the `delay_span_bug` guard was added
to protect against a potential logic error when returning traits. As it
happens, there are cases, like the one above, where traits can indeed be
returned, so valid code was being rejected.
Mara Bos [Wed, 3 Feb 2021 17:51:12 +0000 (18:51 +0100)]
Rollup merge of #80394 - RalfJung:const-err-future, r=oli-obk
make const_err a future incompat lint
This is the first step for https://github.com/rust-lang/rust/issues/71800: make const_err a future-incompat lint. I also rewrote the const_err lint description as the old one seemed wrong.
This has the unfortunate side-effect of making const-eval error even more verbose by making the const_err message longer without fixing the redundancy caused by additionally emitting an error on each use site of the constant. We cannot fix that redundancy until const_err is a *hard* error (at that point the error-on-use-site can be turned into a `delay_span_bug!` for uses of monomorphic consts, and into a nicely rendered error for [lazily / post-monomorhization evaluated] associated consts).
~~The one annoying effect of this PR is that `let _x = &(1/(1-1));` now also shows the future-incompat warning, even though of course we will *not* make this a hard error. We'll instead (hopefully) stop promoting it -- see https://github.com/rust-lang/rfcs/pull/3027. The only way I see to avoid the future-incompat warning is to use a different lint for "failure to evaluate promoted".~~
The tab replacement for diagnostics added in #79757 included a few assertions to
ensure all tab characters are handled appropriately. We've started getting
reports of these assertions firing (#81614). Since it's only a cosmetic issue,
this downgrades the assertions to debug only, so we at least continue compiling
even if the diagnostics might be a tad wonky.
Before this change it would ICE. In #70998 the removed logic was added
to provide better suggestions, and the `delay_span_bug` guard was added
to protect against a potential logic error when returning traits. As it
happens, there are cases, like the one above, where traits can indeed be
returned, so valid code was being rejected.