Matthias Krüger [Sun, 13 Mar 2022 19:01:58 +0000 (20:01 +0100)]
Rollup merge of #93292 - nvzqz:nonzero-bits, r=dtolnay
Implement `BITS` constant for non-zero integers
This adds the associated [`BITS`](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.BITS) constant to `NonZero{U,I}{8,16,32,64,128,size}`.
This is useful when a type alias refers to either a regular or non-zero integer.
bors [Sun, 13 Mar 2022 15:53:14 +0000 (15:53 +0000)]
Auto merge of #94704 - Kobzol:llvm-pgo-update-suite, r=Mark-Simulacrum
Gather LLVM PGO profiles from `rustc-perf` suite on real-world crates
This PR expands the benchmark suite used to gather LLVM PGO profiles in CI from `libcore` to several real-world crates. I hand-picked a few crates, but the list is up for debate.
Running `libcore` + `rustc-perf` with some number of crates is repeated now (and for BOLT it will also be needed), so maybe we can extract it to a bash function?
bors [Sun, 13 Mar 2022 13:30:18 +0000 (13:30 +0000)]
Auto merge of #94899 - workingjubilee:bump-simd-clamp, r=workingjubilee
Bump portable-simd to shadow Ord
Yon usual bump.
Summary for reference:
- We are moving away from the subjective "directional" nomenclature, so `horizontal_*` becomes `reduce_*`, et cetera.
- In addition, `Simd<Int, N>` now has methods which shadow Ord's methods directly, making those methods behave like the already "overloaded" float methods do.
bors [Sun, 13 Mar 2022 00:01:32 +0000 (00:01 +0000)]
Auto merge of #94895 - matthiaskrgr:rollup-9hue5qk, r=matthiaskrgr
Rollup of 3 pull requests
Successful merges:
- #94867 (Add regression test for `<i32 as Iterator>::count`)
- #94886 (Update browser-ui-test version used in CI)
- #94894 (Remove needless use of `Into`)
Matthias Krüger [Sat, 12 Mar 2022 21:56:02 +0000 (22:56 +0100)]
Rollup merge of #94886 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Update browser-ui-test version used in CI
I realized that the extension of `assert-text*` commands was generated not completely valid (it stopped at first "success" and moved instead of running all checks). It was fixed in [this PR](https://github.com/GuillaumeGomez/browser-UI-test/pull/280).
We don't use this feature currently in the rustdoc GUI tests, but just in case...
Work towards https://github.com/rust-lang/rust/issues/89554
Filter fields that are marked `doc(hidden)` or are unstable with that feature turned off. This brings structs and enums into alignment behavior-wise when emitting warning/errors about pattern exhaustiveness/reachability.
bors [Sat, 12 Mar 2022 16:37:07 +0000 (16:37 +0000)]
Auto merge of #94711 - ouz-a:master3, r=oli-obk
Return early to fix ICE
This fixes #94627, ICE happens because compiler tries to suggest constraining type parameter but the only constraint is implicit `std::Sized` one, so it gets removed and there is nothing to suggest resulting in ICE.
where a synthetic generic parameter called `impl Clone` with generic trait bound
`Clone` is added to the function declaration.
The generated HTML filters out these generic parameters by doing
`self.params.iter().filter(|p| !p.is_synthetic_type_param())`, because the
synthetic generic paramter is not of interest to regular users.
For the same reason, we should expose whether or not a generic parameter is
synthetic or not also in the rustdoc JSON, so that rustdoc JSON clients can also
have the option to hide syntehtic generic parameters.
bors [Sat, 12 Mar 2022 07:02:05 +0000 (07:02 +0000)]
Auto merge of #94733 - nnethercote:fix-AdtDef-interning, r=fee1-dead
Improve `AdtDef` interning.
This commit makes `AdtDef` use `Interned`. Much of the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
bors [Fri, 11 Mar 2022 21:44:06 +0000 (21:44 +0000)]
Auto merge of #94860 - Dylan-DPC:rollup-n06j8h6, r=Dylan-DPC
Rollup of 7 pull requests
Successful merges:
- #87618 (Add missing documentation for std::char types)
- #94769 (Collapse blanket and auto-trait impls by default)
- #94798 (`parse_tt` refactorings)
- #94818 (Rename `IntoFuture::Future` to `IntoFuture::IntoFuture`)
- #94827 (CTFE/Miri: detect out-of-bounds pointers in offset_from)
- #94838 (Make float parsing docs more comprehensive)
- #94839 (Suggest using double colon when a struct field type include single colon)
Dylan DPC [Fri, 11 Mar 2022 19:29:46 +0000 (20:29 +0100)]
Rollup merge of #94838 - antonok-edm:float-parse-docs, r=Dylan-DPC
Make float parsing docs more comprehensive
I was working on some code with some specialized restrictions on float parsing. I noticed the doc comments for `f32::from_str` and `f64::from_str` were missing several cases of valid inputs that are otherwise difficult to discover without looking at source code.
I'm not sure if the doc comments were initially intended to contain a comprehensive description of valid inputs, but I figured it's useful to include these extra cases for reference.
Dylan DPC [Fri, 11 Mar 2022 19:29:45 +0000 (20:29 +0100)]
Rollup merge of #94827 - RalfJung:offset-from-ub, r=oli-obk
CTFE/Miri: detect out-of-bounds pointers in offset_from
Also I became uneasy with aggressively doing `try_to_int` here -- this will always succeed on Miri, leading to the wrong codepath being taken. We should rather try to convert them both to pointers, and use the integer path as a fallback, so that's what I implemented now.
This renames `IntoFuture::Future` to `IntoFuture::IntoFuture`. This adds the `Into*` prefix to the associated type, similar to the [`IntoIterator::IntoIter`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html#associatedtype.IntoIter) associated type. It's my mistake we didn't do so in the first place. This fixes that and brings the two closer together. Thanks!
### References
__`IntoIterator` trait def__
```rust
pub trait IntoIterator {
type Item;
type IntoIter: Iterator<Item = Self::Item>;
fn into_iter(self) -> Self::IntoIter;
}
```
__`IntoFuture` trait def__
```rust
pub trait IntoFuture {
type Output;
type IntoFuture: Future<Output = Self::Output>; // Prior to this PR: `type Future:`
fn into_future(self) -> Self::IntoFuture;
}
```
bors [Fri, 11 Mar 2022 19:23:55 +0000 (19:23 +0000)]
Auto merge of #94472 - JmPotato:use_maybeuninit_for_vecdeque, r=m-ou-se
Use MaybeUninit in VecDeque to remove the undefined behavior of slice
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Ref https://github.com/rust-lang/rust/issues/74189. Adjust the code to follow the [doc.rust-lang.org/reference/behavior-considered-undefined.html](https://doc.rust-lang.org/reference/behavior-considered-undefined.html).
* Change the return type of `buffer_as_slice` from `&[T]` to `&[MaybeUninit<T>]`.
* Add some corresponding safety comments.
bors [Fri, 11 Mar 2022 16:37:55 +0000 (16:37 +0000)]
Auto merge of #90253 - Kobzol:hash-stable-sort-index-map, r=cjgillot
Change several HashMaps to IndexMap to improve incremental hashing performance
Stable hashing hash maps in incremental mode takes a lot of time, especially for some benchmarks like `clap`. As noted by `@Mark-Simulacrum` [here](https://github.com/rust-lang/rust/pull/89404#issuecomment-950043892), this cost could be reduced by replacing some hash maps by indexmaps.
I gathered some statistics and found several hash maps that took a lot of time to hash and replaced them by indexmaps. However, in order for this to work, we need to make sure that these indexmaps have deterministic insertion order. These three are used only in visitors as far as I can see, which seems deterministic. Can we enforce this somehow? Or should some explaining comment be included for these maps?
bors [Fri, 11 Mar 2022 13:56:33 +0000 (13:56 +0000)]
Auto merge of #94845 - Dylan-DPC:rollup-3phylaq, r=Dylan-DPC
Rollup of 5 pull requests
Successful merges:
- #93283 (Fix for localized windows editions in testcase fn read_link() Issue#93211)
- #94592 (Fallback to top-level config.toml if not present in current directory, and remove fallback for env vars and CLI flags)
- #94776 (Optimize ascii::escape_default)
- #94840 (update `replace_bound_vars_with_placeholders` doc comment)
- #94842 (Remove unnecessary try_opt for operations that cannot fail)
Dylan DPC [Fri, 11 Mar 2022 12:38:37 +0000 (13:38 +0100)]
Rollup merge of #94776 - martingms:optimize-escape-default, r=nnethercote
Optimize ascii::escape_default
`ascii::escape_default` showed up as a hot function when compiling `deunicode-1.3.1` in `@nnethercote's` [analysis](https://hackmd.io/mxdn4U58Su-UQXwzOHpHag) of `@lqd's` [rustc-benchmarking-data](https://github.com/lqd/rustc-benchmarking-data).
After taking a look at the generated assembly it looked like a LUT-based approach could be faster for `hexify()`-ing ascii characters, so that's what this PR implements
The patch looks like it provides about a 1-2% improvement in instructions for that particular crate. This should definitely be verified with a perf run as I'm still getting used to the `rustc-perf` tooling and might easily have made an error!
Dylan DPC [Fri, 11 Mar 2022 12:38:36 +0000 (13:38 +0100)]
Rollup merge of #94592 - jyn514:consistent-config-loading, r=Mark-Simulacrum
Fallback to top-level config.toml if not present in current directory, and remove fallback for env vars and CLI flags
This preserves the behavior where x.py will only give a hard error on a missing config file if it was configured through `--config` or RUST_BOOTSTRAP_CONFIG. It also removes the top-level fallback for everything except the default path; presumably if you're passing the path explicitly, you expect it to be exactly there and don't want to look in the root directory.
Dylan DPC [Fri, 11 Mar 2022 12:38:36 +0000 (13:38 +0100)]
Rollup merge of #93283 - m1guelperez:master, r=Mark-Simulacrum
Fix for localized windows editions in testcase fn read_link() Issue#93211
This PR aims to fix the issue with localized windows versions that do not necessarily have the folder "Documents and settings" in English.
The idea was provided by `@the8472.` We check if the "CI" environment variable is set, then we always check for the "Documents and Settings"-folder, otherwise we check if the folder exists on the local machine, and if not we skip this assert.
The current structure makes it hard to tell that there are just four
distinct code paths, depending on how many items there are in `bb_items`
and `next_items`. This commit introduces a `match` that clarifies
things.
Dylan DPC [Fri, 11 Mar 2022 02:32:06 +0000 (03:32 +0100)]
Rollup merge of #94826 - allgoewer:fix-retain-documentation, r=yaahc
Improve doc wording for retain on some collections
I found the documentation wording on the various retain methods on many collections to be unusual.
I tried to invert the relation by switching `such that` with `for which` .
Dylan DPC [Fri, 11 Mar 2022 02:32:04 +0000 (03:32 +0100)]
Rollup merge of #94765 - m-ou-se:is-some-and, r=Dylan-DPC
Rename is_{some,ok,err}_with to is_{some,ok,err}_and.
This renames `is_{some,ok,err}_with` to `is_{some,ok,err}_and`. This was discussed on the [tracking issue](https://github.com/rust-lang/rust/issues/93050).
Dylan DPC [Fri, 11 Mar 2022 02:32:02 +0000 (03:32 +0100)]
Rollup merge of #93293 - nvzqz:nonzero-min-max, r=joshtriplett
Implement `MIN`/`MAX` constants for non-zero integers
This adds the associated [`MIN`](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.MIN)/[`MAX`](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.MAX) constants to `NonZero{U,I}{8,16,32,64,128,size}`, requested in #89065.
This reimplements #89077 due that PR being stagnant for 4 months. I am fine with closing this in favor of that one if the author revisits it. If so, I'd like to see that PR have the docs link to the `$Int`'s constants.
This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
Dylan DPC [Thu, 10 Mar 2022 22:12:59 +0000 (23:12 +0100)]
Rollup merge of #94719 - jonhoo:enable-static-lld, r=Mark-Simulacrum
Statically compile libstdc++ everywhere if asked
PR #93918 made it so that `-static-libstdc++` was only set in one place,
and was only set during linking, but accidentally also made it so that
it is no longer passed when building LLD, only when building LLVM
itself. This moves the logic for setting `-static-libstdc++` in the
linker flags to `configure_cmake` so that it takes effect for all CMake
invocations in `native.rs`.
As a side-effect, this also causes libstdc++ to be statically compiled
into sanitizers, whereas previously the `llvm-static-stdcpp` flag had no
effect on sanitizers. It also makes it so that LLD will be compiled
statically if `llvm-tools-enabled` is set, even though previously it was
only linked statically if `llvm-static-stdcpp` was set explicitly. Both
of these seem like they match expected behavior than what was there
prior to #93918.