]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoMerge both "search-result-color" GUI tests
Guillaume Gomez [Tue, 15 Mar 2022 19:41:24 +0000 (20:41 +0100)]
Merge both "search-result-color" GUI tests

2 years agoAuto merge of #94139 - est31:let_else_rustdoc, r=notriddle
bors [Mon, 14 Mar 2022 07:39:53 +0000 (07:39 +0000)]
Auto merge of #94139 - est31:let_else_rustdoc, r=notriddle

librustdoc: adopt let else in more places

Continuation of #89933, #91018, #91481, #93046, #93590, #94011.

I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This PR handles librustdoc.

2 years agoAuto merge of #94921 - aDotInTheVoid:rustdoc-json-format-cleanup, r=CraftSpider
bors [Mon, 14 Mar 2022 05:10:49 +0000 (05:10 +0000)]
Auto merge of #94921 - aDotInTheVoid:rustdoc-json-format-cleanup, r=CraftSpider

rustdoc-json: Clean Up json format

No semantic changes, but better names

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

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

r? `@CraftSpider`

`@rustbot` modify labels: +A-rustdoc-json +T-rustdoc +C-cleanup

2 years agoAuto merge of #94773 - cjgillot:lifetime-fresh-did, r=oli-obk
bors [Mon, 14 Mar 2022 02:49:21 +0000 (02:49 +0000)]
Auto merge of #94773 - cjgillot:lifetime-fresh-did, r=oli-obk

Identify anonymous lifetimes by their DefId in HIR.

`ParamName::Fresh` currently identifies anonymous lifetimes by an `usize` index computed from the number of lifetimes in scope. This makes the behaviour of lowering dependent on the contents of the surrounding item in unpredictable ways.

This PR replaces this index by the `LocalDefId` of the synthetized generic lifetime parameter. This makes obvious which parameter the lifetime corresponds to.

2 years agorustdoc-json-types: implementors -> implementations
Nixon Enraght-Moony [Sun, 13 Mar 2022 23:37:04 +0000 (23:37 +0000)]
rustdoc-json-types: implementors -> implementations

Closes #94198

2 years agorustdoc-json-types: ty -> type_
Nixon Enraght-Moony [Sun, 13 Mar 2022 23:13:57 +0000 (23:13 +0000)]
rustdoc-json-types: ty -> type_

Fixes #94889

2 years agoAuto merge of #94832 - jonhoo:default-static, r=Mark-Simulacrum
bors [Sun, 13 Mar 2022 23:06:14 +0000 (23:06 +0000)]
Auto merge of #94832 - jonhoo:default-static, r=Mark-Simulacrum

bootstrap: untangle static-libstdcpp & llvm-tools

Previously, the static-libstdcpp setting was tied to llvm-tools such
that enabling the latter always enabled the latter. This seems
unfortunate, since it is entirely reasonable for someone to want to
_not_ statically link stdc++, but _also_ want to build the llvm-tools.
This patch therefore separates the two settings such that neither
implies the other.

On its own, that would change the default behavior in a way that's
likely to surprise users. Specifically, users who build llvm-tools
_likely_ want those tools to be statically compiled against libstdc++,
since otherwise users with older GLIBCXX will be unable to run the
vended tools. So, we also flip the default for the `static-libstdcpp`
setting such that builds always link statically against libstdc++ by
default, but it's _possible_ to opt out.

See also #94719.

2 years agoUpdate comments.
Camille GILLOT [Sun, 13 Mar 2022 22:13:58 +0000 (23:13 +0100)]
Update comments.

2 years agoAuto merge of #94916 - matthiaskrgr:rollup-s6zedfl, r=matthiaskrgr
bors [Sun, 13 Mar 2022 20:59:29 +0000 (20:59 +0000)]
Auto merge of #94916 - matthiaskrgr:rollup-s6zedfl, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #93292 (Implement `BITS` constant for non-zero integers)
 - #94777 (Update armv7-unknown-linux-uclibceabi platform support page.)
 - #94816 (Add `Atomic*::get_mut_slice`)
 - #94844 (Reduce rustbuild bloat caused by serde_derive)
 - #94907 (Omit stdarch test crates from the rust-src component)

Failed merges:

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

2 years agoRollup merge of #94907 - bjorn3:smaller_rust_src_component, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Mar 2022 19:02:02 +0000 (20:02 +0100)]
Rollup merge of #94907 - bjorn3:smaller_rust_src_component, r=Mark-Simulacrum

Omit stdarch test crates from the rust-src component

These crates aren't necessary for building the standard library. This saves 30MB of disk space.

Fixes #94906

2 years agoRollup merge of #94844 - bjorn3:rustbuild_cleanup, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Mar 2022 19:02:01 +0000 (20:02 +0100)]
Rollup merge of #94844 - bjorn3:rustbuild_cleanup, r=Mark-Simulacrum

Reduce rustbuild bloat caused by serde_derive

This reduces the size of the `.text` section from 10.1MiB (6.2MiB for just rustbuild code) to 9.3MiB (5.3MiB for just rustbuild code).

This also reduces compile time from ~6.1s for incr recompilation to ~5.6s.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #94816 - WaffleLapkin:atomic_get_mut_slice, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Mar 2022 19:02:00 +0000 (20:02 +0100)]
Rollup merge of #94816 - WaffleLapkin:atomic_get_mut_slice, r=Mark-Simulacrum

Add `Atomic*::get_mut_slice`

This PR adds the inverse of `Atomic*::from_mut_slice` introduced in #94384 with the following API:
```rust
// core::sync::atomic

impl Atomic* {
    fn get_mut_slice(this: &mut [Self]) -> &mut [*];
}
```

cc `@cuviper`

-----

For now I've used the same tracking issue as `Atomic*::from_mut_slice`, should I open a new one?

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 #94738 - Urgau:rustbuild-check-cfg-values, r=Mark-Simulacrum
bors [Sun, 13 Mar 2022 18:34:00 +0000 (18:34 +0000)]
Auto merge of #94738 - Urgau:rustbuild-check-cfg-values, r=Mark-Simulacrum

Enable conditional checking of values in the Rust codebase

This pull-request enable conditional checking of (well known) values in the Rust codebase.

Well known values were added in https://github.com/rust-lang/rust/pull/94362. All the `target_*` values are taken from all the built-in targets which is why some extra values were needed do be added as they are not (yet ?) defined in any built-in targets.

r? `@Mark-Simulacrum`

2 years agoOmit stdarch test crates from the rust-src component
bjorn3 [Sun, 13 Mar 2022 14:09:48 +0000 (15:09 +0100)]
Omit stdarch test crates from the rust-src component

These crates aren't necessary for building the standard library. This
saves 30MB of disk space.

Fixes #94906

2 years agoRemove FieldName enum
bjorn3 [Sun, 13 Mar 2022 16:35:02 +0000 (17:35 +0100)]
Remove FieldName enum

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 agoPrevent duplicate monomorphization of deserialization impls
bjorn3 [Thu, 3 Mar 2022 17:44:02 +0000 (18:44 +0100)]
Prevent duplicate monomorphization of deserialization impls

This reduces binary size from 9.7MiB (5.8MiB for just rustbuild code)
to 9.3MiB (5.3MiB for just rustbuild code).

This doesn't reduce compile time in a statistically significant way.

2 years agoUse trimmed down deserialization impl for config
bjorn3 [Wed, 2 Mar 2022 18:43:43 +0000 (19:43 +0100)]
Use trimmed down deserialization impl for config

This reduces binary size from 10.1MiB (6.2MiB for just rustbuild code)
to 9.7MiB (5.8MiB for just rustbuild code).

This also reduces compile time from ~6.1s for incr recompilation to ~5.6s.

There is still a lot of
unnecessary code due to the toml crate monomorphizing every
deserialization impl 5 times.

2 years agoRename derive_merge macro to define_config and move Deserialize impl into it
bjorn3 [Wed, 2 Mar 2022 17:38:40 +0000 (18:38 +0100)]
Rename derive_merge macro to define_config and move Deserialize impl into it

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 agoIdentify anonymous lifetimes by their DefId in HIR.
Camille GILLOT [Tue, 1 Mar 2022 20:08:26 +0000 (21:08 +0100)]
Identify anonymous lifetimes by their DefId in HIR.

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.