]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #94777 - lancethepants:armv7-unknown-linux-uclibceabi, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Mar 2022 19:01:59 +0000 (20:01 +0100)]
Rollup merge of #94777 - lancethepants:armv7-unknown-linux-uclibceabi, r=Mark-Simulacrum

Update armv7-unknown-linux-uclibceabi platform support page.

A few edits and fixes to the support page for the armv7-unknown-linux-uclibceabi target.

2 years agoRollup merge of #93292 - nvzqz:nonzero-bits, r=dtolnay
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.

2 years agoAuto merge of #94704 - Kobzol:llvm-pgo-update-suite, r=Mark-Simulacrum
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.

Previous results that we got from running `syn,cargo,serde` looked pretty [good](https://perf.rust-lang.org/compare.html?start=2631aeef823a9e16d31f999d3f07001e5fcc4b3d&end=abf097afa10dde1aa3d8a1d422724a46aab79bf3).

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?

r? `@Mark-Simulacrum`

2 years agoAuto merge of #94899 - workingjubilee:bump-simd-clamp, r=workingjubilee
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.

2 years agoAuto merge of #94897 - camelid:query-doc-hidden, r=cjgillot
bors [Sun, 13 Mar 2022 11:12:01 +0000 (11:12 +0000)]
Auto merge of #94897 - camelid:query-doc-hidden, r=cjgillot

Queryify `is_doc_hidden`

It came up hot on some profiling of rustdoc I did, so hopefully turning
it into a query will help.

2 years agoAuto merge of #94320 - GuillaumeGomez:sidebar-display, r=jsha
bors [Sun, 13 Mar 2022 07:56:08 +0000 (07:56 +0000)]
Auto merge of #94320 - GuillaumeGomez:sidebar-display, r=jsha

Fix sidebar elements display

The bug can be seen more easily when the javascript is disabled:

![Screenshot from 2022-02-24 12-18-28](https://user-images.githubusercontent.com/3050060/155514578-cbefd3dd-f006-47e9-bc76-7c26d7e823e8.png)

r? `@jsha`

2 years agoAuto merge of #94862 - pierwill:bootstrap-useless, r=Dylan-DPC
bors [Sun, 13 Mar 2022 05:37:56 +0000 (05:37 +0000)]
Auto merge of #94862 - pierwill:bootstrap-useless, r=Dylan-DPC

Remove unneeded conversions in bootstrapping code

Fixes warnings from `clippy::useless_conversion` in `src/bootstrap`.

2 years agoAuto merge of #94898 - RalfJung:miri, r=RalfJung
bors [Sun, 13 Mar 2022 02:27:30 +0000 (02:27 +0000)]
Auto merge of #94898 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/94871

2 years agoUse reduce_sum in as_simd example
Jubilee Young [Sun, 13 Mar 2022 00:43:38 +0000 (16:43 -0800)]
Use reduce_sum in as_simd example

2 years agoupdate Miri
Ralf Jung [Sun, 13 Mar 2022 00:30:26 +0000 (19:30 -0500)]
update Miri

2 years agoSync portable-simd to rust-lang/portable-simd@72df4c45056a8bc0d1b3f06fdc828722177f0763
Jubilee Young [Sun, 13 Mar 2022 00:09:37 +0000 (16:09 -0800)]
Sync portable-simd to rust-lang/portable-simd@72df4c45056a8bc0d1b3f06fdc828722177f0763

2 years agoAuto merge of #94895 - matthiaskrgr:rollup-9hue5qk, r=matthiaskrgr
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`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoportable-simd#261: Rename horizontal_* to reduce_*
Jubilee [Sat, 12 Mar 2022 23:34:58 +0000 (15:34 -0800)]
portable-simd#261: Rename horizontal_* to reduce_*

2 years agorust-lang/portable-simd#262: also implement clamp for integer vectors
Ralf Jung [Sat, 12 Mar 2022 23:32:28 +0000 (18:32 -0500)]
rust-lang/portable-simd#262: also implement clamp for integer vectors

* add test from issue rust-lang/portable-simd#253

2 years agoQueryify `is_doc_hidden`
Noah Lev [Sat, 12 Mar 2022 22:27:51 +0000 (14:27 -0800)]
Queryify `is_doc_hidden`

It came up hot on some profiling of rustdoc I did, so hopefully turning
it into a query will help.

2 years agoRollup merge of #94894 - camelid:into, r=nagisa
Matthias Krüger [Sat, 12 Mar 2022 21:56:02 +0000 (22:56 +0100)]
Rollup merge of #94894 - camelid:into, r=nagisa

Remove needless use of `Into`

2 years agoRollup merge of #94886 - GuillaumeGomez:update-browser-ui-test, r=notriddle
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...

r? ``@notriddle``

2 years agoRollup merge of #94867 - notriddle:notriddle/i32-count-regression-test, r=Dylan-DPC
Matthias Krüger [Sat, 12 Mar 2022 21:56:01 +0000 (22:56 +0100)]
Rollup merge of #94867 - notriddle:notriddle/i32-count-regression-test, r=Dylan-DPC

Add regression test for `<i32 as Iterator>::count`

Closes #84495

2 years agoAuto merge of #90358 - DevinR528:omitted-field-fix, r=jackh726
bors [Sat, 12 Mar 2022 21:34:30 +0000 (21:34 +0000)]
Auto merge of #90358 - DevinR528:omitted-field-fix, r=jackh726

Fix exposing fields marked unstable or doc hidden

Closes https://github.com/rust-lang/rust/issues/89837

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.

cc `@Nadrieril`

2 years agoRemove needless use of `Into`
Noah Lev [Sat, 12 Mar 2022 21:00:12 +0000 (13:00 -0800)]
Remove needless use of `Into`

2 years agoFix rebase conflicts with stderr files
Devin Ragotzy [Sat, 12 Mar 2022 20:38:44 +0000 (15:38 -0500)]
Fix rebase conflicts with stderr files

2 years agoFormat reordered imports in tyck/pat
Devin Ragotzy [Sun, 6 Mar 2022 23:01:03 +0000 (18:01 -0500)]
Format reordered imports in tyck/pat

2 years agoOnly filter doc(hidden) fields/variants when not crate local
Devin Ragotzy [Mon, 6 Dec 2021 21:17:22 +0000 (16:17 -0500)]
Only filter doc(hidden) fields/variants when not crate local

2 years agoUpdate output for doc hidden usefulness ui test output
Devin Ragotzy [Thu, 28 Oct 2021 00:58:23 +0000 (20:58 -0400)]
Update output for doc hidden usefulness ui test output

2 years agoAdd struct to doc hidden usefulness ui tests
Devin Ragotzy [Thu, 28 Oct 2021 00:57:47 +0000 (20:57 -0400)]
Add struct to doc hidden usefulness ui tests

2 years agoAdd struct to stability ui tests in usefulness
Devin Ragotzy [Thu, 28 Oct 2021 00:55:44 +0000 (20:55 -0400)]
Add struct to stability ui tests in usefulness

2 years agoUpdate non-exhaustive omitted_patterns ui output
Devin Ragotzy [Thu, 28 Oct 2021 00:30:26 +0000 (20:30 -0400)]
Update non-exhaustive omitted_patterns ui output

2 years agoAdd unstable struct fields to ui tests
Devin Ragotzy [Thu, 28 Oct 2021 00:29:53 +0000 (20:29 -0400)]
Add unstable struct fields to ui tests

2 years agoFix omitted_patterns lint showing unstable/doc hidden fields
Devin Ragotzy [Thu, 28 Oct 2021 00:29:14 +0000 (20:29 -0400)]
Fix omitted_patterns lint showing unstable/doc hidden fields

2 years agoAuto merge of #94865 - notriddle:notriddle/single-colon-path-not-const-generics,...
bors [Sat, 12 Mar 2022 19:10:33 +0000 (19:10 +0000)]
Auto merge of #94865 - notriddle:notriddle/single-colon-path-not-const-generics, r=cjgillot

diagnostics: single colon within `<>` probably, not type ascription

Fixes #94812

2 years agoAuto merge of #94711 - ouz-a:master3, r=oli-obk
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.

2 years agodon't call multipart_suggestion
ouz-a [Sat, 12 Mar 2022 15:51:28 +0000 (18:51 +0300)]
don't call multipart_suggestion

2 years agoUse consistent prose for `::`
Michael Howell [Sat, 12 Mar 2022 15:20:36 +0000 (08:20 -0700)]
Use consistent prose for `::`

Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2 years agoUpdate browser-ui-test version used in CI
Guillaume Gomez [Sat, 12 Mar 2022 15:07:42 +0000 (16:07 +0100)]
Update browser-ui-test version used in CI

2 years agoAuto merge of #94873 - DrMeepster:box_alloc_ice3, r=oli-obk
bors [Sat, 12 Mar 2022 14:18:34 +0000 (14:18 +0000)]
Auto merge of #94873 - DrMeepster:box_alloc_ice3, r=oli-obk

Fix ICE when using Box<T, A>, again

Sequel to #94043, fixes #94835.

2 years agoUse `Self::BITS` in `log2` implementation
Nikolai Vazquez [Sat, 12 Mar 2022 13:01:35 +0000 (08:01 -0500)]
Use `Self::BITS` in `log2` implementation

2 years agoImplement `BITS` constant for non-zero integers
Nikolai Vazquez [Sat, 12 Mar 2022 13:00:45 +0000 (08:00 -0500)]
Implement `BITS` constant for non-zero integers

2 years agoAuto merge of #94870 - notriddle:notriddle/filter-regression, r=oli-obk
bors [Sat, 12 Mar 2022 11:58:07 +0000 (11:58 +0000)]
Auto merge of #94870 - notriddle:notriddle/filter-regression, r=oli-obk

diagnostics: do not spurriously claim something is "not an iterator"

Fixes a minor regression caused by #94746, where `iter::Filter` is spurriously declared "not an iterator."

2 years agoAuto merge of #94875 - matthiaskrgr:rollup-tq1li2d, r=matthiaskrgr
bors [Sat, 12 Mar 2022 09:30:06 +0000 (09:30 +0000)]
Auto merge of #94875 - matthiaskrgr:rollup-tq1li2d, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #94150 (rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSON)
 - #94833 ([2/2] Implement macro meta-variable expression)
 - #94863 (Remove redundant slicing of whole ranges in `bootstrap`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #94863 - pierwill:bootstrap-slicing, r=Mark-Simulacrum
Matthias Krüger [Sat, 12 Mar 2022 08:35:47 +0000 (09:35 +0100)]
Rollup merge of #94863 - pierwill:bootstrap-slicing, r=Mark-Simulacrum

Remove redundant slicing of whole ranges in `bootstrap`

Found with `clippy::redundant_slicing`.

2 years agoRollup merge of #94833 - c410-f3r:meta-take-2, r=petrochenkov
Matthias Krüger [Sat, 12 Mar 2022 08:35:45 +0000 (09:35 +0100)]
Rollup merge of #94833 - c410-f3r:meta-take-2, r=petrochenkov

[2/2] Implement macro meta-variable expression

Final part of https://github.com/rust-lang/rust/pull/93545#issuecomment-1050963295

r? `@petrochenkov`

2 years agoRollup merge of #94150 - Enselic:synthetic-generic-parameters-in-json, r=CraftSpider
Matthias Krüger [Sat, 12 Mar 2022 08:35:44 +0000 (09:35 +0100)]
Rollup merge of #94150 - Enselic:synthetic-generic-parameters-in-json, r=CraftSpider

rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSON

The rustdoc JSON for

```
pub fn f(_: impl Clone) {}
```

will effectively be

```
pub fn f<impl Clone: Clone>(_: impl Clone) {}
```

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.

`@rustbot` modify labels: +A-rustdoc-json

2 years agoAuto merge of #94733 - nnethercote:fix-AdtDef-interning, r=fee1-dead
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`.

r? `@fee1-dead`

2 years agorust-lang/portable-simd#259: remove Miri from CI
Ralf Jung [Sat, 12 Mar 2022 02:14:52 +0000 (21:14 -0500)]
rust-lang/portable-simd#259: remove Miri from CI

2 years agofix another assumption about box
DrMeepster [Sat, 12 Mar 2022 01:00:56 +0000 (17:00 -0800)]
fix another assumption about box

2 years agoChange beginner's guide to explain Reducing rather than Horizontal.
Jacob Lifshay [Fri, 11 Mar 2022 22:54:36 +0000 (14:54 -0800)]
Change beginner's guide to explain Reducing rather than Horizontal.

2 years agodiagnostics: do not spurriously claim something is "not an iterator"
Michael Howell [Fri, 11 Mar 2022 23:58:14 +0000 (16:58 -0700)]
diagnostics: do not spurriously claim something is "not an iterator"

Fixes a minor regression caused by #94746, where iter::Filter is
spurriously declared "not an iterator."

2 years agoAdd regression test for `<i32 as Iterator>::count`
Michael Howell [Fri, 11 Mar 2022 23:21:31 +0000 (16:21 -0700)]
Add regression test for `<i32 as Iterator>::count`

Fixes #84495

2 years agoreplace horizontal_* with reduce_*
Jacob Lifshay [Fri, 11 Mar 2022 22:49:06 +0000 (14:49 -0800)]
replace horizontal_* with reduce_*

2 years agodiagnostics: single colon within `<>` probably, not type ascription
Michael Howell [Fri, 11 Mar 2022 22:26:19 +0000 (15:26 -0700)]
diagnostics: single colon within `<>` probably, not type ascription

Fixes #94812

2 years agoAuto merge of #94860 - Dylan-DPC:rollup-n06j8h6, r=Dylan-DPC
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)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoImplement macro meta-variable expression
Caio [Fri, 11 Mar 2022 20:48:51 +0000 (17:48 -0300)]
Implement macro meta-variable expression

2 years agoRemove redundant slicing of whole ranges in `bootstrap`
pierwill [Fri, 11 Mar 2022 19:51:48 +0000 (13:51 -0600)]
Remove redundant slicing of whole ranges in `bootstrap`

2 years agoRemove unneeded conversions in bootstrapping code
pierwill [Fri, 11 Mar 2022 19:38:31 +0000 (13:38 -0600)]
Remove unneeded conversions in bootstrapping code

Fixes warnings from `clippy::useless_conversion` in `src/bootstrap`.

2 years agoRollup merge of #94839 - TaKO8Ki:suggest-using-double-colon-for-struct-field-type...
Dylan DPC [Fri, 11 Mar 2022 19:29:47 +0000 (20:29 +0100)]
Rollup merge of #94839 - TaKO8Ki:suggest-using-double-colon-for-struct-field-type, r=cjgillot

Suggest using double colon when a struct field type include single colon

#92685

2 years agoRollup merge of #94838 - antonok-edm:float-parse-docs, r=Dylan-DPC
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.

2 years agoRollup merge of #94827 - RalfJung:offset-from-ub, r=oli-obk
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.

Hiding whitespaces helps with the diff.

Fixes https://github.com/rust-lang/miri/issues/1950

r? ``@oli-obk``

2 years agoRollup merge of #94818 - yoshuawuyts:into-future-associated-type, r=joshtriplett
Dylan DPC [Fri, 11 Mar 2022 19:29:45 +0000 (20:29 +0100)]
Rollup merge of #94818 - yoshuawuyts:into-future-associated-type, r=joshtriplett

Rename `IntoFuture::Future` to `IntoFuture::IntoFuture`

Ref: https://github.com/rust-lang/rust/issues/67644#issuecomment-1051401459

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;
}
```

cc/ `@eholk` `@rust-lang/wg-async`

2 years agoRollup merge of #94798 - nnethercote:parse_tt-refactor, r=petrochenkov
Dylan DPC [Fri, 11 Mar 2022 19:29:44 +0000 (20:29 +0100)]
Rollup merge of #94798 - nnethercote:parse_tt-refactor, r=petrochenkov

`parse_tt` refactorings

Some readability improvements.

r? ``@petrochenkov``

2 years agoRollup merge of #94769 - GuillaumeGomez:collapsed-by-default, r=notriddle
Dylan DPC [Fri, 11 Mar 2022 19:29:43 +0000 (20:29 +0100)]
Rollup merge of #94769 - GuillaumeGomez:collapsed-by-default, r=notriddle

Collapse blanket and auto-trait impls by default

Blocked on #94740 (the two first commits come from it).

This behaviour was changed in https://github.com/rust-lang/rust/pull/88490 and apparently wasn't caught since then.

You can test it [here](https://rustdoc.crud.net/imperio/collapsed-by-default/test_docs/struct.Foo.html#blanket-implementations).

r? ``@notriddle``

2 years agoRollup merge of #87618 - GuillaumeGomez:std-char-types-doc, r=jyn514,camelid
Dylan DPC [Fri, 11 Mar 2022 19:29:42 +0000 (20:29 +0100)]
Rollup merge of #87618 - GuillaumeGomez:std-char-types-doc, r=jyn514,camelid

Add missing documentation for std::char types

2 years agoAuto merge of #94472 - JmPotato:use_maybeuninit_for_vecdeque, r=m-ou-se
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.

Benchmark results:

master 8d6f527530f4ba974d922269267fe89050188789

```rust
test collections::vec_deque::tests::bench_pop_back_100       ... bench:          47 ns/iter (+/- 1)
test collections::vec_deque::tests::bench_pop_front_100      ... bench:          50 ns/iter (+/- 4)
test collections::vec_deque::tests::bench_push_back_100      ... bench:          69 ns/iter (+/- 10)
test collections::vec_deque::tests::bench_push_front_100     ... bench:          72 ns/iter (+/- 6)
test collections::vec_deque::tests::bench_retain_half_10000  ... bench:     145,891 ns/iter (+/- 7,975)
test collections::vec_deque::tests::bench_retain_odd_10000   ... bench:     141,647 ns/iter (+/- 3,711)
test collections::vec_deque::tests::bench_retain_whole_10000 ... bench:     120,132 ns/iter (+/- 4,078)
```

This PR

```rust
test collections::vec_deque::tests::bench_pop_back_100       ... bench:          48 ns/iter (+/- 2)
test collections::vec_deque::tests::bench_pop_front_100      ... bench:          51 ns/iter (+/- 3)
test collections::vec_deque::tests::bench_push_back_100      ... bench:          73 ns/iter (+/- 2)
test collections::vec_deque::tests::bench_push_front_100     ... bench:          73 ns/iter (+/- 2)
test collections::vec_deque::tests::bench_retain_half_10000  ... bench:     131,796 ns/iter (+/- 5,440)
test collections::vec_deque::tests::bench_retain_odd_10000   ... bench:     137,563 ns/iter (+/- 3,349)
test collections::vec_deque::tests::bench_retain_whole_10000 ... bench:     128,815 ns/iter (+/- 3,289)
```

2 years agoAuto merge of #90253 - Kobzol:hash-stable-sort-index-map, r=cjgillot
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?

2 years agoAuto merge of #94845 - Dylan-DPC:rollup-3phylaq, r=Dylan-DPC
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)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoUpdate GUI test
Guillaume Gomez [Tue, 8 Mar 2022 16:52:31 +0000 (17:52 +0100)]
Update GUI test

2 years agoCollapse Blanket Implementations and Auto-trait implementations by default
Guillaume Gomez [Tue, 8 Mar 2022 16:51:16 +0000 (17:51 +0100)]
Collapse Blanket Implementations and Auto-trait implementations by default

2 years agoRollup merge of #94842 - tspiteri:there-is-no-try, r=Dylan-DPC
Dylan DPC [Fri, 11 Mar 2022 12:38:39 +0000 (13:38 +0100)]
Rollup merge of #94842 - tspiteri:there-is-no-try, r=Dylan-DPC

Remove unnecessary try_opt for operations that cannot fail

As indicated in the added comments, some operation cannot overflow, so using `try_opt!` for them is unnecessary.

2 years agoRollup merge of #94840 - lcnr:update-comment, r=Dylan-DPC
Dylan DPC [Fri, 11 Mar 2022 12:38:38 +0000 (13:38 +0100)]
Rollup merge of #94840 - lcnr:update-comment, r=Dylan-DPC

update `replace_bound_vars_with_placeholders` doc comment

2 years agoRollup merge of #94776 - martingms:optimize-escape-default, r=nnethercote
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!

2 years agoRollup merge of #94592 - jyn514:consistent-config-loading, r=Mark-Simulacrum
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.

Fixes https://github.com/rust-lang/rust/issues/94589.

2 years agoRollup merge of #93283 - m1guelperez:master, r=Mark-Simulacrum
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.

Resoles #93211.

2 years agofix a suggestion message
Takayuki Maeda [Fri, 11 Mar 2022 12:26:06 +0000 (21:26 +0900)]
fix a suggestion message

2 years agoremove unnecessary try_opt for operations that cannot fail
Trevor Spiteri [Fri, 11 Mar 2022 10:07:45 +0000 (11:07 +0100)]
remove unnecessary try_opt for operations that cannot fail

2 years agoupdate comment
lcnr [Fri, 11 Mar 2022 08:51:42 +0000 (09:51 +0100)]
update comment

2 years agosuggest using double colon when using single colon in struct field type path
Takayuki Maeda [Fri, 11 Mar 2022 07:15:57 +0000 (16:15 +0900)]
suggest using double colon when using single colon in struct field type path

2 years agoAuto merge of #94304 - notriddle:notriddle/buffer-args, r=CraftSpider
bors [Fri, 11 Mar 2022 06:47:49 +0000 (06:47 +0000)]
Auto merge of #94304 - notriddle:notriddle/buffer-args, r=CraftSpider

rustdoc: write directly to buffer in `inner_full_print`

This change avoids several temporary allocations for every argument.

2 years agomake float parsing docs more comprehensive
Anton Lazarev [Fri, 11 Mar 2022 06:20:46 +0000 (22:20 -0800)]
make float parsing docs more comprehensive

2 years agoAuto merge of #94834 - Dylan-DPC:rollup-sza4qc2, r=Dylan-DPC
bors [Fri, 11 Mar 2022 04:32:33 +0000 (04:32 +0000)]
Auto merge of #94834 - Dylan-DPC:rollup-sza4qc2, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #93293 (Implement `MIN`/`MAX` constants for non-zero integers)
 - #94356 (Rename unix::net::SocketAddr::from_path to from_pathname and stabilize it)
 - #94765 (Rename is_{some,ok,err}_with to is_{some,ok,err}_and.)
 - #94819 (configure: don't serialize empty array elements)
 - #94826 (Improve doc wording for retain on some collections)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoMove a `parse_tt` error case into a separate function.
Nicholas Nethercote [Wed, 9 Mar 2022 03:51:31 +0000 (14:51 +1100)]
Move a `parse_tt` error case into a separate function.

2 years agoMake next_items a `SmallVec`.
Nicholas Nethercote [Wed, 9 Mar 2022 03:37:45 +0000 (14:37 +1100)]
Make next_items a `SmallVec`.

For consistency, and to make the code slightly nicer.

2 years agoMove `eof_items` handling entirely within `inner_parse_loop`.
Nicholas Nethercote [Wed, 9 Mar 2022 03:34:24 +0000 (14:34 +1100)]
Move `eof_items` handling entirely within `inner_parse_loop`.

Also rename `inner_parse_loop` as `parse_tt_inner`, because it's no
longer just a loop.

2 years agoAdd a useful assertion.
Nicholas Nethercote [Wed, 9 Mar 2022 23:06:57 +0000 (10:06 +1100)]
Add a useful assertion.

2 years agoDisallow `TokenTree::{MetaVar,MetaVarExpr}` in matchers.
Nicholas Nethercote [Wed, 9 Mar 2022 05:58:13 +0000 (16:58 +1100)]
Disallow `TokenTree::{MetaVar,MetaVarExpr}` in matchers.

They should only appear in transcribers.

2 years agoRefactor the second half of `parse_tt`.
Nicholas Nethercote [Wed, 9 Mar 2022 03:18:32 +0000 (14:18 +1100)]
Refactor the second half of `parse_tt`.

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.

2 years agoRollup merge of #94826 - allgoewer:fix-retain-documentation, r=yaahc
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` .

2 years agoRollup merge of #94819 - jonhoo:configure-empty-list, r=Mark-Simulacrum
Dylan DPC [Fri, 11 Mar 2022 02:32:05 +0000 (03:32 +0100)]
Rollup merge of #94819 - jonhoo:configure-empty-list, r=Mark-Simulacrum

configure: don't serialize empty array elements

Before this change:

    $ ./configure --codegen-backends=
    [..]
    $ grep -P '^codegen-backends' config.toml
    codegen-backends = ['']

After this change:

    $ ./configure --codegen-backends=
    [..]
    $ grep -P '^codegen-backends' config.toml
    codegen-backends = []

2 years agoRollup merge of #94765 - m-ou-se:is-some-and, r=Dylan-DPC
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).

2 years agoRollup merge of #94356 - Thomasdezeeuw:stabilize_unix_socket_creation, r=dtolnay
Dylan DPC [Fri, 11 Mar 2022 02:32:03 +0000 (03:32 +0100)]
Rollup merge of #94356 - Thomasdezeeuw:stabilize_unix_socket_creation, r=dtolnay

Rename unix::net::SocketAddr::from_path to from_pathname and stabilize it

Stabilizes `unix_socket_creation`.

Closes https://github.com/rust-lang/rust/issues/93423
r? `@m-ou-se`

2 years agoRollup merge of #93293 - nvzqz:nonzero-min-max, r=joshtriplett
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.

2 years agoImprove `AdtDef` interning.
Nicholas Nethercote [Fri, 4 Mar 2022 20:28:41 +0000 (07:28 +1100)]
Improve `AdtDef` interning.

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`.

2 years agoAuto merge of #94276 - scottmcm:primitive-clone, r=oli-obk
bors [Fri, 11 Mar 2022 01:51:49 +0000 (01:51 +0000)]
Auto merge of #94276 - scottmcm:primitive-clone, r=oli-obk

mir-opt: Replace clone on primitives with copy

We can't do it for everything, but it would be nice to at least stop making calls to clone methods in debug from things like derived-clones.

r? `@ghost`

2 years agoadjust offset_from logic: check that both pointers are in-bounds
Ralf Jung [Thu, 10 Mar 2022 23:30:32 +0000 (18:30 -0500)]
adjust offset_from logic: check that both pointers are in-bounds

2 years agoImprove doc wording for retain on some collections
Maik Allgöwer [Thu, 10 Mar 2022 23:16:45 +0000 (00:16 +0100)]
Improve doc wording for retain on some collections

2 years agorust-lang/portable-simd#260: Add `.min` and `.max` for integers
Jorge Leitao [Thu, 10 Mar 2022 23:12:40 +0000 (00:12 +0100)]
rust-lang/portable-simd#260: Add `.min` and `.max` for integers

2 years agoAuto merge of #94824 - Dylan-DPC:rollup-iamc09j, r=Dylan-DPC
bors [Thu, 10 Mar 2022 23:10:59 +0000 (23:10 +0000)]
Auto merge of #94824 - Dylan-DPC:rollup-iamc09j, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #93950 (Use modern formatting for format! macros)
 - #94274 (Treat unstable lints as unknown)
 - #94368 ([1/2] Implement macro meta-variable expressions)
 - #94719 (Statically compile libstdc++ everywhere if asked)
 - #94728 (Only emit pointer-like metadata for `Box<T, A>` when `A` is ZST)
 - #94790 (enable portable-simd doctests in Miri)
 - #94811 (Update browser-ui-test version)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoMove note about 0 gap to signed integers
Nikolai Vazquez [Thu, 10 Mar 2022 22:52:48 +0000 (17:52 -0500)]
Move note about 0 gap to signed integers

Was accidentally placed on unsigned integers, where it is not relevant.

2 years agoRollup merge of #94811 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Dylan DPC [Thu, 10 Mar 2022 22:13:02 +0000 (23:13 +0100)]
Rollup merge of #94811 - GuillaumeGomez:update-browser-ui-test, r=notriddle

Update browser-ui-test version

It should help with #93784 (the important PR helping in this regard is https://github.com/GuillaumeGomez/browser-UI-test/pull/273).

r? `@notriddle`

2 years agoRollup merge of #94790 - RalfJung:portable-simd-miri, r=Dylan-DPC
Dylan DPC [Thu, 10 Mar 2022 22:13:01 +0000 (23:13 +0100)]
Rollup merge of #94790 - RalfJung:portable-simd-miri, r=Dylan-DPC

enable portable-simd doctests in Miri

With https://github.com/rust-lang/miri/pull/2013 we shouldn't need to disable these tests any more. :)

2 years agoRollup merge of #94728 - compiler-errors:box-allocator-zst-meta, r=michaelwoerister
Dylan DPC [Thu, 10 Mar 2022 22:13:00 +0000 (23:13 +0100)]
Rollup merge of #94728 - compiler-errors:box-allocator-zst-meta, r=michaelwoerister

Only emit pointer-like metadata for `Box<T, A>` when `A` is ZST

Basically copy the change in #94043, but for debuginfo.

r? ``@michaelwoerister``

Fixes #94725

2 years agoRollup merge of #94719 - jonhoo:enable-static-lld, r=Mark-Simulacrum
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.