]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoFix suggesting turbofish with lifetime arguments
Michael Goulet [Thu, 13 Jan 2022 23:44:17 +0000 (15:44 -0800)]
Fix suggesting turbofish with lifetime arguments

2 years agoAuto merge of #92553 - m-ou-se:thread-join-simplify, r=Mark-Simulacrum
bors [Thu, 13 Jan 2022 03:46:19 +0000 (03:46 +0000)]
Auto merge of #92553 - m-ou-se:thread-join-simplify, r=Mark-Simulacrum

Simpilfy thread::JoinInner.

`JoinInner`'s `native` field was an `Option`, but that's unnecessary.

Also, thanks to `Arc::get_mut`, there's no unsafety needed in `JoinInner::join()`.

2 years agoAuto merge of #92526 - djc:rustdoc-askama, r=jsha
bors [Thu, 13 Jan 2022 00:29:34 +0000 (00:29 +0000)]
Auto merge of #92526 - djc:rustdoc-askama, r=jsha

Migrate rustdoc from Tera to Askama

See #84419.

Should probably get a benchmarking run to verify if it has the intended effect on rustdoc performance.

cc `@jsha` `@jyn514.`

2 years agoAuto merge of #92169 - In-line:no-cache-selector-lrc, r=Mark-Simulacrum
bors [Wed, 12 Jan 2022 21:04:40 +0000 (21:04 +0000)]
Auto merge of #92169 - In-line:no-cache-selector-lrc, r=Mark-Simulacrum

Remove ArenaCacheSelector for visible_parent_map query ( + LRC)

2 years agoAuto merge of #92811 - matthiaskrgr:rollup-wrctcef, r=matthiaskrgr
bors [Wed, 12 Jan 2022 17:57:50 +0000 (17:57 +0000)]
Auto merge of #92811 - matthiaskrgr:rollup-wrctcef, r=matthiaskrgr

Rollup of 14 pull requests

Successful merges:

 - #92328 (Tweak sentence in `transmute` docs)
 - #92432 (Error when selected impl is not const in constck)
 - #92506 (Document Box<T> FFI guarantee in 1.41.0 release notes)
 - #92699 (rustdoc: Display "private fields" instead of "fields omitted")
 - #92703 (RELEASES.md: Add 1.58 release note for `File::options` stabilization)
 - #92707 (Extended the note on the use of `no_run` attribute)
 - #92709 (Improve documentation for File::options to give a more likely example)
 - #92720 (Fix doc formatting for time.rs)
 - #92732 (Add note about upstream commit musl-patch-configure.diff is derived from)
 - #92742 (Add missing suffix for sidebar-items script path)
 - #92748 (Eliminate "boxed" wording in `std::error::Error` documentation)
 - #92754 (Update AsmArgs field visibility for rustfmt)
 - #92756 (:arrow_up: rust-analyzer)
 - #92764 (Fix rust logo style)

Failed merges:

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

2 years agoRollup merge of #92764 - GuillaumeGomez:fix-rust-logo-style, r=jsha
Matthias Krüger [Wed, 12 Jan 2022 06:12:19 +0000 (07:12 +0100)]
Rollup merge of #92764 - GuillaumeGomez:fix-rust-logo-style, r=jsha

Fix rust logo style

The style on the rust logo is currently broken:

![Screenshot from 2022-01-11 13-36-30](https://user-images.githubusercontent.com/3050060/148946754-a1a57253-bed0-44cf-a41c-83e0eecbd6b5.png)

With this fix, we're back to normal:

![Screenshot from 2022-01-11 13-42-07](https://user-images.githubusercontent.com/3050060/148946778-99f44678-aac1-419f-bb8c-ffa837e0c1ee.png)

I also used a GUI test to prevent future silent regressions.

r? ```@jsha```

2 years agoRollup merge of #92756 - lnicola:rust-analyzer-2022-01-11, r=lnicola
Matthias Krüger [Wed, 12 Jan 2022 06:12:17 +0000 (07:12 +0100)]
Rollup merge of #92756 - lnicola:rust-analyzer-2022-01-11, r=lnicola

:arrow_up: rust-analyzer

r? ```@ghost```

2 years agoRollup merge of #92754 - ytmimi:AsmArgs-field-visibility, r=calebcartwright
Matthias Krüger [Wed, 12 Jan 2022 06:12:16 +0000 (07:12 +0100)]
Rollup merge of #92754 - ytmimi:AsmArgs-field-visibility, r=calebcartwright

Update AsmArgs field visibility for rustfmt

To more easily allow rustfmt to format the ``asm!`` macro as specified in
rust-dev-tools/fmt-rfcs#152 certain fields are made public.

r? ```@calebcartwright```

2 years agoRollup merge of #92748 - david-perez:eliminate-boxed-wording-std-error, r=Mark-Simulacrum
Matthias Krüger [Wed, 12 Jan 2022 06:12:15 +0000 (07:12 +0100)]
Rollup merge of #92748 - david-perez:eliminate-boxed-wording-std-error, r=Mark-Simulacrum

Eliminate "boxed" wording in `std::error::Error` documentation

In commit 29403ee, documentation for the methods on `std::any::Any` was
modified so that they referred to the concrete value behind the trait
object as the "inner" value. This is a more accurate wording than
"boxed": while putting trait objects inside boxes is arguably the most
common use, they can also be placed behind other pointer types like
`&mut` or `std::sync::Arc`.

This commit does the same documentation changes for `std::error::Error`.

2 years agoRollup merge of #92742 - GuillaumeGomez:missing-suffix-sidebar-items, r=notriddle
Matthias Krüger [Wed, 12 Jan 2022 06:12:15 +0000 (07:12 +0100)]
Rollup merge of #92742 - GuillaumeGomez:missing-suffix-sidebar-items, r=notriddle

Add missing suffix for sidebar-items script path

Fixes https://github.com/rust-lang/docs.rs/issues/1590.

r? ```@syphar```

2 years agoRollup merge of #92732 - wesleywiser:note_musl_patch_info, r=Mark-Simulacrum
Matthias Krüger [Wed, 12 Jan 2022 06:12:14 +0000 (07:12 +0100)]
Rollup merge of #92732 - wesleywiser:note_musl_patch_info, r=Mark-Simulacrum

Add note about upstream commit musl-patch-configure.diff is derived from

The patch landed in upstream over the weekend so I'm adding a note so we can more easily track when our patch file can be removed.

2 years agoRollup merge of #92720 - rosik:patch-1, r=m-ou-se
Matthias Krüger [Wed, 12 Jan 2022 06:12:13 +0000 (07:12 +0100)]
Rollup merge of #92720 - rosik:patch-1, r=m-ou-se

Fix doc formatting for time.rs

The doc states that instants are not steady, but the word "not" wasn't highlighted in bold.

2 years agoRollup merge of #92709 - joshtriplett:file-options-docs, r=Mark-Simulacrum
Matthias Krüger [Wed, 12 Jan 2022 06:12:12 +0000 (07:12 +0100)]
Rollup merge of #92709 - joshtriplett:file-options-docs, r=Mark-Simulacrum

Improve documentation for File::options to give a more likely example

`File::options().read(true).open(...)` is equivalent to just
`File::open`. Change the example to set the `append` flag instead, and
then change the filename to something more likely to be written in
append mode.

2 years agoRollup merge of #92707 - JohnScience:patch-1, r=GuillaumeGomez
Matthias Krüger [Wed, 12 Jan 2022 06:12:11 +0000 (07:12 +0100)]
Rollup merge of #92707 - JohnScience:patch-1, r=GuillaumeGomez

Extended the note on the use of `no_run` attribute

2 years agoRollup merge of #92703 - joshtriplett:relnotes-file-options, r=pietroalbini
Matthias Krüger [Wed, 12 Jan 2022 06:12:10 +0000 (07:12 +0100)]
Rollup merge of #92703 - joshtriplett:relnotes-file-options, r=pietroalbini

RELEASES.md: Add 1.58 release note for `File::options` stabilization

2 years agoRollup merge of #92699 - camelid:private-fields, r=jsha
Matthias Krüger [Wed, 12 Jan 2022 06:12:09 +0000 (07:12 +0100)]
Rollup merge of #92699 - camelid:private-fields, r=jsha

rustdoc: Display "private fields" instead of "fields omitted"

Also:

  * Always use `/* */` block comments
  * Use the same message everywhere, rather than sometimes prefixing
    with "some"

When I first read rustdoc docs, I was confused why the fields were being
omitted. It was only later that I realized it was because they were
private. It's also always bothered me that rustdoc sometimes uses `//`
and sometimes uses `/*` comments for these messages, so this change
makes them all use `/*`.

Technically, I think fields can be omitted if they are public but
`doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's
really just used to emulate "doc privacy" when -- because of technical
limitations -- an item has to be public. So I think it's fine to include
this under the category of "private fields".

r? ```@jsha```

2 years agoRollup merge of #92506 - nico-abram:uwu, r=Mark-Simulacrum
Matthias Krüger [Wed, 12 Jan 2022 06:12:08 +0000 (07:12 +0100)]
Rollup merge of #92506 - nico-abram:uwu, r=Mark-Simulacrum

Document Box<T> FFI guarantee in 1.41.0 release notes

Fixes #68676

2 years agoRollup merge of #92432 - fee1-dead:constck-impl-constness, r=oli-obk
Matthias Krüger [Wed, 12 Jan 2022 06:12:06 +0000 (07:12 +0100)]
Rollup merge of #92432 - fee1-dead:constck-impl-constness, r=oli-obk

Error when selected impl is not const in constck

Catches bad things when checking a `default_method_body_is_const` body, such as:

```rust
self.map(/* .. */).is_sorted();
```

When `Map` does not yet have a `const` `impl` for `Iterator`.

r? ```@oli-obk```

2 years agoRollup merge of #92328 - camelid:sentence, r=scottmcm
Matthias Krüger [Wed, 12 Jan 2022 06:12:05 +0000 (07:12 +0100)]
Rollup merge of #92328 - camelid:sentence, r=scottmcm

Tweak sentence in `transmute` docs

2 years agoAuto merge of #92533 - Aaron1011:variant-symbol, r=petrochenkov
bors [Tue, 11 Jan 2022 21:02:01 +0000 (21:02 +0000)]
Auto merge of #92533 - Aaron1011:variant-symbol, r=petrochenkov

Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`

The field is also renamed from `ident` to `name`. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.

2 years agoAuto merge of #90948 - oli-obk:🧹, r=nikomatsakis
bors [Tue, 11 Jan 2022 17:31:07 +0000 (17:31 +0000)]
Auto merge of #90948 - oli-obk:🧹, r=nikomatsakis

Actually instantiate the opaque type when checking bounds

Before this change, `instantiate_opaque_types` was a no-op, because it only works relative to the defined opaque type inference anchor. If it is a no-op, the for loop will not actually have anything to iterate over, and thus nothing is checked at all.

2 years agoAdd test
Deadbeef [Tue, 11 Jan 2022 15:52:24 +0000 (23:52 +0800)]
Add test

2 years agoStore a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`
Aaron Hill [Mon, 3 Jan 2022 03:37:05 +0000 (22:37 -0500)]
Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`

The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.

2 years agoAuto merge of #92070 - rukai:replace_vec_into_iter_with_array_into_iter, r=Mark-Simul...
bors [Tue, 11 Jan 2022 14:23:24 +0000 (14:23 +0000)]
Auto merge of #92070 - rukai:replace_vec_into_iter_with_array_into_iter, r=Mark-Simulacrum

Replace usages of vec![].into_iter with [].into_iter

`[].into_iter` is idiomatic over `vec![].into_iter` because its simpler and faster (unless the vec is optimized away in which case it would be the same)

So we should change all the implementation, documentation and tests to use it.

I skipped:
* `src/tools` - Those are copied in from upstream
* `src/test/ui` - Hard to tell if `vec![].into_iter` was used intentionally or not here and not much benefit to changing it.
*  any case where `vec![].into_iter` was used because we specifically needed a `Vec::IntoIter<T>`
*  any case where it looked like we were intentionally using `vec![].into_iter` to test it.

2 years agoAdd GUI test for rust logo style in the sidebars
Guillaume Gomez [Tue, 11 Jan 2022 12:57:17 +0000 (13:57 +0100)]
Add GUI test for rust logo style in the sidebars

2 years agoFix style for rust logo
Guillaume Gomez [Tue, 11 Jan 2022 12:42:20 +0000 (13:42 +0100)]
Fix style for rust logo

2 years agoAuto merge of #92012 - llogiq:repr-c-def-id, r=michaelwoerister
bors [Tue, 11 Jan 2022 08:09:00 +0000 (08:09 +0000)]
Auto merge of #92012 - llogiq:repr-c-def-id, r=michaelwoerister

Make `DefId` `repr(C)`, optimize big-endian field order

r? `@michaelwoerister`

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 11 Jan 2022 05:20:40 +0000 (07:20 +0200)]
:arrow_up: rust-analyzer

2 years agoUpdate AsmArgs field visibility for rustfmt
Yacin Tmimi [Tue, 11 Jan 2022 02:48:22 +0000 (21:48 -0500)]
Update AsmArgs field visibility for rustfmt

To more easily allow rustfmt to format the asm! macro as specified in
rust-dev-tools/fmt-rfcs#152 certain fields are made public.

2 years agoAuto merge of #92601 - camelid:more-intra-doc-cleanup, r=Manishearth
bors [Tue, 11 Jan 2022 00:08:23 +0000 (00:08 +0000)]
Auto merge of #92601 - camelid:more-intra-doc-cleanup, r=Manishearth

rustdoc: Remove the intra-doc links side channel

The side channel made the code much more complex and harder to
understand. It was added as a temporary workaround in
0c99d806eabd32a2ee2e6c71b400222b99c659e1, but it's no longer necessary.

The addition of `UrlFragment` in #92088 was the key to getting rid of
the side channel. The semantic information (rather than the strings that
used to be used for fragments) that is now captured by `UrlFragment` is
enough to obviate the side channel. An additional change had to be made
to `UrlFragment` in this PR to make this possible: it now records
`DefId`s rather than item names.

This PR also consolidates the checks for anchor conflicts into one place.

r? `@Manishearth`

2 years agoImprove documentation for File::options to give a more likely example
Josh Triplett [Sun, 9 Jan 2022 22:08:08 +0000 (14:08 -0800)]
Improve documentation for File::options to give a more likely example

`File::options().read(true).open(...)` is equivalent to just
`File::open`. Change the example to set the `append` flag instead, and
then change the filename to something more likely to be written in
append mode.

2 years agoDocument Box<T> FFI guarantee in 1.41.0 release notes
unknown [Mon, 3 Jan 2022 04:39:43 +0000 (01:39 -0300)]
Document Box<T> FFI guarantee in 1.41.0 release notes
Fixes #68676

2 years agoEliminate "boxed" wording in `std::error::Error` documentation
david-perez [Mon, 10 Jan 2022 22:18:34 +0000 (23:18 +0100)]
Eliminate "boxed" wording in `std::error::Error` documentation

In commit 29403ee, documentation for the methods on `std::any::Any` was
modified so that they referred to the concrete value behind the trait
object as the "inner" value. This is a more accurate wording than
"boxed": while putting trait objects inside boxes is arguably the most
common use, they can also be placed behind other pointer types like
`&mut` or `std::sync::Arc`.

This commit does the same documentation changes for `std::error::Error`.

2 years agoAdd missing suffix for sidebar-items script path
Guillaume Gomez [Mon, 10 Jan 2022 20:01:09 +0000 (21:01 +0100)]
Add missing suffix for sidebar-items script path

2 years agoRemove configuration which became unused in 8abb4bb698c9d74507adb9cd7b54a032f3c1b595
Dirkjan Ochtman [Sun, 9 Jan 2022 20:33:00 +0000 (21:33 +0100)]
Remove configuration which became unused in 8abb4bb698c9d74507adb9cd7b54a032f3c1b595

2 years agoAddress feedback
Dirkjan Ochtman [Mon, 3 Jan 2022 20:16:05 +0000 (21:16 +0100)]
Address feedback

2 years agoMigrate rustdoc from Tera to Askama
Dirkjan Ochtman [Mon, 3 Jan 2022 17:18:46 +0000 (18:18 +0100)]
Migrate rustdoc from Tera to Askama

See #84419.

2 years agoAdd note about upstream commit musl-patch-configure.diff is derived from
Wesley Wiser [Mon, 10 Jan 2022 15:41:31 +0000 (10:41 -0500)]
Add note about upstream commit musl-patch-configure.diff is derived from

2 years agoAuto merge of #92719 - matthiaskrgr:rollup-tc7oqys, r=matthiaskrgr
bors [Mon, 10 Jan 2022 11:53:15 +0000 (11:53 +0000)]
Auto merge of #92719 - matthiaskrgr:rollup-tc7oqys, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #92248 (Normalize struct tail type when checking Pointee trait)
 - #92357 (Fix invalid removal of newlines from doc comments)
 - #92602 (Make source links look cleaner)
 - #92636 (Normalize generator-local types with unevaluated constants)
 - #92693 (Release notes: add `Result::unwrap_{,err_}unchecked`)
 - #92702 (Clean up lang_items::extract)
 - #92717 (update miri)

Failed merges:

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

2 years agoFix doc formatting for time.rs
Yaroslav Dynnikov [Mon, 10 Jan 2022 11:22:45 +0000 (14:22 +0300)]
Fix doc formatting for time.rs

The doc states that instants are not steady, but the word "not" wasn't highlighted in bold.

2 years agoRollup merge of #92717 - RalfJung:miri, r=RalfJung
Matthias Krüger [Mon, 10 Jan 2022 10:03:12 +0000 (11:03 +0100)]
Rollup merge of #92717 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/92691
r? `@ghost`

2 years agoRollup merge of #92702 - ehuss:clean-lang_items-extract, r=petrochenkov
Matthias Krüger [Mon, 10 Jan 2022 10:03:11 +0000 (11:03 +0100)]
Rollup merge of #92702 - ehuss:clean-lang_items-extract, r=petrochenkov

Clean up lang_items::extract

Noted in https://github.com/rust-lang/rust/pull/87739#pullrequestreview-740497194,
lang_items::extract no longer needs to take a closure.

2 years agoRollup merge of #92693 - ojeda:relnotes, r=pietroalbini
Matthias Krüger [Mon, 10 Jan 2022 10:03:09 +0000 (11:03 +0100)]
Rollup merge of #92693 - ojeda:relnotes, r=pietroalbini

Release notes: add `Result::unwrap_{,err_}unchecked`

They were stabilized together with `Option::unwrap_unchecked`
in https://github.com/rust-lang/rust/issues/81383.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoRollup merge of #92636 - compiler-errors:normalize-generator-const-expr, r=oli-obk
Matthias Krüger [Mon, 10 Jan 2022 10:03:07 +0000 (11:03 +0100)]
Rollup merge of #92636 - compiler-errors:normalize-generator-const-expr, r=oli-obk

Normalize generator-local types with unevaluated constants

Normalize generator-interior types in addition to (i.e. instead of just) erasing regions, since sometimes we collect types with unevaluated const exprs.

Fixes #84737
Fixes #88171
Fixes #92091
Fixes #92634
Probably also fixes #73114, but that one has no code I could test. It looks like it's the same issue, though.

2 years agoRollup merge of #92602 - jsha:source-link-2, r=GuillaumeGomez
Matthias Krüger [Mon, 10 Jan 2022 10:03:06 +0000 (11:03 +0100)]
Rollup merge of #92602 - jsha:source-link-2, r=GuillaumeGomez

Make source links look cleaner

Change from syntaxy-looking [src] to the plain word "source".

Change the syntaxy-looking `[-]` at the top of the page to say "collapse".

Reduce opacity of rightside content.

Part of #59851

r? `@GuillaumeGomez`

Demo: https://rustdoc.crud.net/jsha/source-link-2/std/string/struct.String.html

[Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/display.20of.20source.20link).

2 years agoRollup merge of #92357 - GuillaumeGomez:fix-doc-comment-backline-removal, r=camelid
Matthias Krüger [Mon, 10 Jan 2022 10:03:05 +0000 (11:03 +0100)]
Rollup merge of #92357 - GuillaumeGomez:fix-doc-comment-backline-removal, r=camelid

Fix invalid removal of newlines from doc comments

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

Before:

![Screenshot from 2021-12-28 17-02-11](https://user-images.githubusercontent.com/3050060/147585187-c8e67531-c1b4-457d-9d30-d5b44bf91fea.png)

After:

![Screenshot from 2021-12-28 17-02-25](https://user-images.githubusercontent.com/3050060/147585190-30aa0398-1fc7-4fe7-9e8b-5c475d4f9613.png)

r? `@camelid`

2 years agoRollup merge of #92248 - compiler-errors:normalize-type-for-pointee, r=jackh726
Matthias Krüger [Mon, 10 Jan 2022 10:03:03 +0000 (11:03 +0100)]
Rollup merge of #92248 - compiler-errors:normalize-type-for-pointee, r=jackh726

Normalize struct tail type when checking Pointee trait

Let's go ahead and implement the FIXMEs by properly normalizing the struct-tail type when satisfying a Pointee obligation. This should fix the ICE when we try to calculate a layout depending on `<Ty as Pointee>::Metadata` later.
Fixes #92128
Fixes #92577

Additionally, mark the obligation as ambiguous if there are any infer types in that struct-tail type. This has the effect of causing `<_ as Pointee>::Metadata` to be properly replaced with an infer variable ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/project.rs#L813)) and registered as an obligation... this turns out to be very important in unifying function parameters with formals that are assoc types.

Fixes #91446

2 years agomiri
Ralf Jung [Mon, 10 Jan 2022 09:27:34 +0000 (10:27 +0100)]
miri

2 years agoAuto merge of #87487 - lambinoo:I-64762_unreachable_pub_lint, r=petrochenkov
bors [Mon, 10 Jan 2022 08:55:53 +0000 (08:55 +0000)]
Auto merge of #87487 - lambinoo:I-64762_unreachable_pub_lint, r=petrochenkov

Fixes wrong unreachable_pub lints on nested and glob public reexport

Linked issues: #64762 & #82064

2 years agoRELEASES.md: Add 1.58 release note for `File::options` stabilization
Josh Triplett [Sun, 9 Jan 2022 21:47:50 +0000 (13:47 -0800)]
RELEASES.md: Add 1.58 release note for `File::options` stabilization

2 years agoAuto merge of #92278 - Aaron1011:fix-fingerprint-caching, r=michaelwoerister
bors [Mon, 10 Jan 2022 00:26:07 +0000 (00:26 +0000)]
Auto merge of #92278 - Aaron1011:fix-fingerprint-caching, r=michaelwoerister

Ensure that `Fingerprint` caching respects hashing configuration

Fixes #92266

In some `HashStable` impls, we use a cache to avoid re-computing
the same `Fingerprint` from the same structure (e.g. an `AdtDef`).
However, the `StableHashingContext` used can be configured to
perform hashing in different ways (e.g. skipping `Span`s). This
configuration information is not included in the cache key,
which will cause an incorrect `Fingerprint` to be used if
we hash the same structure with different `StableHashingContext`
settings.

To fix this, the configuration settings of `StableHashingContext`
are split out into a separate `HashingControls` struct. This
struct is used as part of the cache key, ensuring that our caches
always produce the correct result for the given settings.

With this in place, we now turn off `Span` hashing during the
entire process of computing the hash included in legacy symbols.
This current has no effect, but will matter when a future PR
starts hashing more `Span`s that we currently skip.

2 years agoExtended the note on the use of `no_run` attribute
Dmitrii - Demenev [Mon, 10 Jan 2022 00:17:15 +0000 (19:17 -0500)]
Extended the note on the use of `no_run` attribute

2 years agoClean up lang_items::extract
Eric Huss [Sun, 9 Jan 2022 21:41:04 +0000 (13:41 -0800)]
Clean up lang_items::extract

Noted in https://github.com/rust-lang/rust/pull/87739#pullrequestreview-740497194,
lang_items::extract no longer needs to take a closure.

2 years agoCompute most of Public/Exported access level in rustc_resolve
Lamb [Mon, 26 Jul 2021 03:38:16 +0000 (05:38 +0200)]
Compute most of Public/Exported access level in rustc_resolve

Mak DefId to AccessLevel map in resolve for export

hir_id to accesslevel in resolve and applied in privacy
using local def id
removing tracing probes
making function not recursive and adding comments

Move most of Exported/Public res to rustc_resolve

moving public/export res to resolve

fix missing stability attributes in core, std and alloc

move code to access_levels.rs

return for some kinds instead of going through them

Export correctness, macro changes, comments

add comment for import binding

add comment for import binding

renmae to access level visitor, remove comments, move fn as closure, remove new_key

fmt

fix rebase

fix rebase

fmt

fmt

fix: move macro def to rustc_resolve

fix: reachable AccessLevel for enum variants

fmt

fix: missing stability attributes for other architectures

allow unreachable pub in rustfmt

fix: missing impl access level + renaming export to reexport

Missing impl access level was found thanks to a test in clippy

2 years agoDisplay "private fields" instead of "fields omitted"
Noah Lev [Sun, 9 Jan 2022 20:41:13 +0000 (12:41 -0800)]
Display "private fields" instead of "fields omitted"

Also:

  * Always use `/* */` block comments
  * Use the same message everywhere, rather than sometimes prefixing
    with "some"

When I first read rustdoc docs, I was confused why the fields were being
omitted. It was only later that I realized it was because they were
private. It's also always bothered me that rustdoc sometimes uses `//`
and sometimes uses `/*` comments for these messages, so this change
makes them all use `/*`.

Technically, I think fields can be omitted if they are public but
`doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's
really just used to emulate "doc privacy" when -- because of technical
limitations -- an item has to be public. So I think it's fine to include
this under the category of "private fields".

2 years agoRelease notes: add `Result::unwrap_{,err_}unchecked`
Miguel Ojeda [Sun, 9 Jan 2022 16:04:08 +0000 (17:04 +0100)]
Release notes: add `Result::unwrap_{,err_}unchecked`

They were stabilized together with `Option::unwrap_unchecked`
in https://github.com/rust-lang/rust/issues/81383.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoAuto merge of #92534 - Aaron1011:hash-hir, r=petrochenkov
bors [Sun, 9 Jan 2022 16:03:41 +0000 (16:03 +0000)]
Auto merge of #92534 - Aaron1011:hash-hir, r=petrochenkov

Hash `Ident` spans in all HIR structures

This PR removes all of the `#[stable_hasher(project(name))]`
attributes used in HIR structs. While these attributes are not known
to be causing any issues in practice, we need to hash these in
order for the incremental system to work correctly -
a query could be otherwise be incorrectly marked green
when a change occures in one of the `Span`s that it uses.

2 years agoAuto merge of #92690 - matthiaskrgr:rollup-rw0oz05, r=matthiaskrgr
bors [Sun, 9 Jan 2022 12:43:37 +0000 (12:43 +0000)]
Auto merge of #92690 - matthiaskrgr:rollup-rw0oz05, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #92055 (Add release notes for 1.58)
 - #92490 (Move crate drop-down to search results page)
 - #92510 (Don't resolve blocks in foreign functions)
 - #92573 (expand: Refactor InvocationCollector visitor for better code reuse)
 - #92608 (rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes)
 - #92657 (Implemented const casts of raw pointers)
 - #92671 (Make `Atomic*::from_mut` return `&mut Atomic*`)
 - #92673 (Remove useless collapse toggle on "all items" page)

Failed merges:

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

2 years agoRollup merge of #92673 - GuillaumeGomez:remove-all-items-toggle, r=jsha
Matthias Krüger [Sun, 9 Jan 2022 12:38:34 +0000 (13:38 +0100)]
Rollup merge of #92673 - GuillaumeGomez:remove-all-items-toggle, r=jsha

Remove useless collapse toggle on "all items" page

When clicking on this toggle, nothing happens because there is nothing to collapse. Instead of keeping it around, let's just remove it.

Before:

![Screenshot from 2022-01-08 16-02-38](https://user-images.githubusercontent.com/3050060/148649149-821a1e77-8c34-4975-b50a-984ca8865518.png)

After:

![Screenshot from 2022-01-08 16-02-32](https://user-images.githubusercontent.com/3050060/148649154-b5912a97-9229-46bd-be3c-df3c3fa3ac8f.png)

r? `@jsha`

2 years agoRollup merge of #92671 - WaffleLapkin:atomic_from_mut_unique_ref, r=m-ou-se
Matthias Krüger [Sun, 9 Jan 2022 12:38:33 +0000 (13:38 +0100)]
Rollup merge of #92671 - WaffleLapkin:atomic_from_mut_unique_ref, r=m-ou-se

Make `Atomic*::from_mut` return `&mut Atomic*`

```rust
impl Atomic* {
    pub fn from_mut(v: &mut bool) -> &mut Self;
    //                               ^^^^---- previously was just a &
}
```

This PR makes `from_mut` atomic methods tracked in #76314 return unique references to atomic types, instead of shared ones. This makes `from_mut` and `get_mut` inverses of each other, allowing to undo either of them by the other.

r? `@RalfJung`
(as Ralf was [concerned](https://github.com/rust-lang/rust/issues/76314#issuecomment-955062593) about this)

2 years agoRollup merge of #92657 - Kixunil:ptr_as_const_mut, r=m-ou-se
Matthias Krüger [Sun, 9 Jan 2022 12:38:33 +0000 (13:38 +0100)]
Rollup merge of #92657 - Kixunil:ptr_as_const_mut, r=m-ou-se

Implemented const casts of raw pointers

This adds `as_mut()` method for `*const T` and `as_const()` for `*mut T`
which are intended to make casting of consts safer. This was discussed
in the [internals discussion][discussion].

Given that this is a simple change and multiple people agreed to it including `@RalfJung` I decided to go ahead and open the PR.

[discussion]: https://internals.rust-lang.org/t/casting-constness-can-be-risky-heres-a-simple-fix/15933

2 years agoRollup merge of #92608 - petrochenkov:doctrscope3, r=CraftSpider
Matthias Krüger [Sun, 9 Jan 2022 12:38:32 +0000 (13:38 +0100)]
Rollup merge of #92608 - petrochenkov:doctrscope3, r=CraftSpider

rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes

The refactoring parts of https://github.com/rust-lang/rust/pull/88679, shouldn't cause any slowdowns.
r? `@jyn514`

2 years agoRollup merge of #92573 - petrochenkov:ltrattr3, r=Aaron1011
Matthias Krüger [Sun, 9 Jan 2022 12:38:31 +0000 (13:38 +0100)]
Rollup merge of #92573 - petrochenkov:ltrattr3, r=Aaron1011

expand: Refactor InvocationCollector visitor for better code reuse

The refactoring part of https://github.com/rust-lang/rust/pull/92473.

Invocation collector visitor logic now lives in two main functions:
- `fn flat_map_node`, corresponding to "one to many" expansions
- `fn visit_node`, corresponding to "one to one" expansions

All specific mut visitor methods now use one of these functions.

The new `InvocationCollectorNode` trait implemented for all `AstFragment` nodes provides the necessary small pieces of functionality required to implement the `(flat_map,visit)_node` functions.
r? `@Aaron1011`

2 years agoRollup merge of #92510 - inquisitivecrystal:foreign-block, r=cjgillot
Matthias Krüger [Sun, 9 Jan 2022 12:38:30 +0000 (13:38 +0100)]
Rollup merge of #92510 - inquisitivecrystal:foreign-block, r=cjgillot

Don't resolve blocks in foreign functions

Although it is an error for a foreign function to have a block, it is still possible at the level of the AST. #74204 made AST lowering skip over blocks belonging to foreign functions, since they're invalid. However, resolve still treated these blocks normally, resulting in a mismatch between the HIR and resolve, which could cause an ICE under certain circumstances. This PR changes resolve to skip over blocks belonging to foreign functions, as AST lowering does.

Fixes #91370.

r? ``@cjgillot``

2 years agoRollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomez
Matthias Krüger [Sun, 9 Jan 2022 12:38:29 +0000 (13:38 +0100)]
Rollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomez

Move crate drop-down to search results page

This reduces clutter on doc pages.

Part of #59840

r? ```@GuillaumeGomez```

Demo: https://rustdoc.crud.net/jsha/crates-in-results/std/index.html?search=str

2 years agoRollup merge of #92055 - tmandry:relnotes-1.58, r=pietroalbini
Matthias Krüger [Sun, 9 Jan 2022 12:38:28 +0000 (13:38 +0100)]
Rollup merge of #92055 - tmandry:relnotes-1.58, r=pietroalbini

Add release notes for 1.58

r? `@rust-lang/release`

2 years agoAuto merge of #92086 - petrochenkov:modchild, r=jackh726
bors [Sun, 9 Jan 2022 10:02:49 +0000 (10:02 +0000)]
Auto merge of #92086 - petrochenkov:modchild, r=jackh726

rustc_metadata: Optimize and document module children decoding

The first commit limits the item in the `item_children`/`each_child_of_item` query to modules (in name resolution sense) and adds a corresponding assertion.
The `associated_item_def_ids` query collecting children of traits and impls specifically now uses a simplified implementation not decoding unnecessary data instead of `each_child_of_item`, this gives a nice performance improvement.

The second commit does some renaming that clarifies the terminology used for all items in a module vs `use` items only.

2 years agoeplace usages of vec![].into_iter with [].into_iter
Lucas Kent [Fri, 17 Dec 2021 07:36:18 +0000 (18:36 +1100)]
eplace usages of vec![].into_iter with [].into_iter

2 years agoAuto merge of #92497 - bjorn3:remove_lazy_meta_min_size, r=eddyb
bors [Sun, 9 Jan 2022 01:29:22 +0000 (01:29 +0000)]
Auto merge of #92497 - bjorn3:remove_lazy_meta_min_size, r=eddyb

Remove LazyMeta::min_size

It is extremely conservative and as such barely reduces the size of encoded Lazy distances, but does increase complexity.

2 years agorustc_middle: Rename `Export` to `ModChild` and add some comments
Vadim Petrochenkov [Tue, 21 Dec 2021 03:24:43 +0000 (11:24 +0800)]
rustc_middle: Rename `Export` to `ModChild` and add some comments

Also rename `module_exports`/`export_map` to `module_reexports`/`reexport_map` for clarity.

2 years agorustc_metadata: Rename `item_children(_untracked)` to `module_children(_untracked)`
Vadim Petrochenkov [Thu, 23 Dec 2021 08:12:34 +0000 (16:12 +0800)]
rustc_metadata: Rename `item_children(_untracked)` to `module_children(_untracked)`

And `each_child_of_item` to `for_each_module_child`

2 years agorustc_metadata: Optimize and document module children decoding
Vadim Petrochenkov [Sat, 18 Dec 2021 12:07:58 +0000 (20:07 +0800)]
rustc_metadata: Optimize and document module children decoding

2 years agoAuto merge of #92068 - fee1-dead:libcore2021, r=m-ou-se
bors [Sat, 8 Jan 2022 21:41:48 +0000 (21:41 +0000)]
Auto merge of #92068 - fee1-dead:libcore2021, r=m-ou-se

Switch all libraries to the 2021 edition

The fix for https://github.com/rust-lang/rust/issues/88638#issuecomment-996620107 is to simply add const-stability for these functions.

r? `@m-ou-se`

Closes #88638.

2 years agoremove float methods
Pietro Albini [Sat, 8 Jan 2022 20:34:01 +0000 (21:34 +0100)]
remove float methods

2 years agoAuto merge of #91919 - Aaron1011:query-recursive-read, r=michaelwoerister
bors [Sat, 8 Jan 2022 18:32:31 +0000 (18:32 +0000)]
Auto merge of #91919 - Aaron1011:query-recursive-read, r=michaelwoerister

Don't perform any new queries while reading a query result on disk

In addition to being very confusing, this can cause us to add dep node edges between two queries that would not otherwise have an edge.

We now panic if any new dep node edges are created during the deserialization of a query result. This requires serializing the full `AdtDef` to disk, instead of just serializing the `DefId` and invoking the `adt_def` query during deserialization.

I'll probably split this up into several smaller PRs for perf runs.

2 years agoImplemented const casts of raw pointers
Martin Habovstiak [Fri, 7 Jan 2022 23:03:02 +0000 (00:03 +0100)]
Implemented const casts of raw pointers

This adds `as_mut()` method for `*const T` and `as_const()` for `*mut T`
which are intended to make casting of consts safer. This was discussed
in the [internals discussion][discussion].

[discussion]: https://internals.rust-lang.org/t/casting-constness-can-be-risky-heres-a-simple-fix/15933

2 years agoAuto merge of #90639 - matthewjasper:leaf-def-cache, r=cjgillot
bors [Sat, 8 Jan 2022 15:20:33 +0000 (15:20 +0000)]
Auto merge of #90639 - matthewjasper:leaf-def-cache, r=cjgillot

Add a query for resolving an impl item from the trait item

This makes finding the item in an impl that implements a given trait item a query. This is for a few reasons:

- To slightly improve performance
- To avoid having to do name resolution during monomorphisation
- To make it easier to implement potential future features that create anonymous associated items

2 years agoRemove useless collapse toggle on "all items" page
Guillaume Gomez [Sat, 8 Jan 2022 15:03:44 +0000 (16:03 +0100)]
Remove useless collapse toggle on "all items" page

2 years agoMake source links look cleaner
Jacob Hoffman-Andrews [Sat, 4 Dec 2021 01:09:04 +0000 (17:09 -0800)]
Make source links look cleaner

Change from syntaxy-looking [src] to the plain word "source".

2 years agoMake `Atomic*::from_mut` return `&mut Atomic*`
Maybe Waffle [Sat, 8 Jan 2022 13:57:20 +0000 (16:57 +0300)]
Make `Atomic*::from_mut` return `&mut Atomic*`

2 years agoRemove LazyMeta::min_size
bjorn3 [Sun, 2 Jan 2022 17:20:37 +0000 (18:20 +0100)]
Remove LazyMeta::min_size

It is extremely conservative and as such barely reduces the size of
encoded Lazy distances, but does increase complexity.

2 years agoAuto merge of #92639 - pietroalbini:bump-version, r=pietroalbini
bors [Sat, 8 Jan 2022 12:06:40 +0000 (12:06 +0000)]
Auto merge of #92639 - pietroalbini:bump-version, r=pietroalbini

Bump version to 1.60.0

Part of the release process, cc `@rust-lang/release`

r? `@ghost`

2 years agoAuto merge of #91305 - camelid:rm-cond, r=GuillaumeGomez
bors [Sat, 8 Jan 2022 08:55:46 +0000 (08:55 +0000)]
Auto merge of #91305 - camelid:rm-cond, r=GuillaumeGomez

rustdoc: Remove apparently unnecessary conditional in `doc_value`

I need to remove this conditional for #91072, but while it seems
unnecessary, we are not certain. So, the plan is to first remove the
conditional and see if any regressions pop up before doing the refactor.
This way, it will be easier to revert if there are subtle regressions.

r? `@jyn514`

2 years agoAuto merge of #92664 - ehuss:rollup-t9yrvk5, r=ehuss
bors [Sat, 8 Jan 2022 06:01:37 +0000 (06:01 +0000)]
Auto merge of #92664 - ehuss:rollup-t9yrvk5, r=ehuss

Rollup of 8 pull requests

Successful merges:

 - #84640 (Implement `TryFrom<char>` for `u8`)
 - #92336 (Remove &self from PrintState::to_string)
 - #92375 (Consolidate checking for msvc when generating debuginfo)
 - #92568 (Add note about non_exhaustive to variant_count)
 - #92600 (Add some missing `#[must_use]` to some `f{32,64}` operations)
 - #92610 (Create CSS class instead of using inline style for search results)
 - #92632 (Implement stabilization of `#[feature(available_parallelism)]`)
 - #92650 (Fix typo in `StableCrateId` docs)

Failed merges:

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

2 years agoRollup merge of #92650 - pierwill:patch-2, r=michaelwoerister
Eric Huss [Sat, 8 Jan 2022 04:21:02 +0000 (20:21 -0800)]
Rollup merge of #92650 - pierwill:patch-2, r=michaelwoerister

Fix typo in `StableCrateId` docs

2 years agoRollup merge of #92632 - yoshuawuyts:stabilize-available-parallelism, r=joshtriplett
Eric Huss [Sat, 8 Jan 2022 04:21:01 +0000 (20:21 -0800)]
Rollup merge of #92632 - yoshuawuyts:stabilize-available-parallelism, r=joshtriplett

Implement stabilization of `#[feature(available_parallelism)]`

Stabilized in https://github.com/rust-lang/rust/issues/74479#issuecomment-984379800. Closes https://github.com/rust-lang/rust/issues/74479. Thanks!

cc/ ``@rust-lang/libs-api``

2 years agoRollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, r=jsha
Eric Huss [Sat, 8 Jan 2022 04:21:01 +0000 (20:21 -0800)]
Rollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, r=jsha

Create CSS class instead of using inline style for search results

I saw this change in the update you proposed in https://github.com/rust-lang/rust/pull/92404. :)

r? ``@jsha``

2 years agoRollup merge of #92600 - asquared31415:float-must-use, r=joshtriplett
Eric Huss [Sat, 8 Jan 2022 04:21:00 +0000 (20:21 -0800)]
Rollup merge of #92600 - asquared31415:float-must-use, r=joshtriplett

Add some missing `#[must_use]` to some `f{32,64}` operations

This PR adds `#[must_use]` to the following methods:
 - `f32::recip`
 - `f32::max`
 - `f32::min`
 - `f32::maximum`
 - `f32::minimum`
 and their equivalents in `f64`.
 These methods all produce a new value without modifying the original and so are pointless to call without using the result.

2 years agoRollup merge of #92568 - Mark-Simulacrum:non-exhaustive-variant-count, r=the8472
Eric Huss [Sat, 8 Jan 2022 04:20:59 +0000 (20:20 -0800)]
Rollup merge of #92568 - Mark-Simulacrum:non-exhaustive-variant-count, r=the8472

Add note about non_exhaustive to variant_count

Since `variant_count` isn't returning something opaque, I thought it makes sense to explicitly call out that its return value may change for some enums.

cc #73662

2 years agoRollup merge of #92375 - wesleywiser:consolidate_debuginfo_msvc_check, r=michaelwoerister
Eric Huss [Sat, 8 Jan 2022 04:20:58 +0000 (20:20 -0800)]
Rollup merge of #92375 - wesleywiser:consolidate_debuginfo_msvc_check, r=michaelwoerister

Consolidate checking for msvc when generating debuginfo

If the target we're generating code for is msvc, then we do two main
things differently: we generate type names in a C++ style instead of a
Rust style and we generate debuginfo for enums differently.

I've refactored the code so that there is one function
(`cpp_like_debuginfo`) which determines if we should use the C++ style
of naming types and other debuginfo generation or the regular Rust one.

r? ``@michaelwoerister``

This PR is not urgent so please don't let it interrupt your holidays! 🎄 🎁

2 years agoRollup merge of #92336 - dtolnay:printstateself, r=michaelwoerister
Eric Huss [Sat, 8 Jan 2022 04:20:56 +0000 (20:20 -0800)]
Rollup merge of #92336 - dtolnay:printstateself, r=michaelwoerister

Remove &self from PrintState::to_string

The point of `PrintState::to_string` is to create a `State` and evaluate the caller's closure on it:

https://github.com/rust-lang/rust/blob/e9fbe79292783972a222afd270db3f77c0b4f3c8/compiler/rustc_ast_pretty/src/pprust/state.rs#L868-L872

Making the caller *also* construct and pass in a `State`, which is then ignored, was confusing.

2 years agoRollup merge of #84640 - ids1024:u8_from_char, r=m-ou-se
Eric Huss [Sat, 8 Jan 2022 04:20:55 +0000 (20:20 -0800)]
Rollup merge of #84640 - ids1024:u8_from_char, r=m-ou-se

Implement `TryFrom<char>` for `u8`

Previously suggested in https://github.com/rust-lang/rfcs/issues/2854.

It makes sense to have this since `char` implements `From<u8>`. Likewise `u32`, `u64`, and `u128` (since #79502) implement `From<char>`.

2 years agoFix accidental undo of 5e1972eba7e95e68f6fc05b07dec15fb1e553e1b
Noah Lev [Fri, 7 Jan 2022 22:16:56 +0000 (14:16 -0800)]
Fix accidental undo of 5e1972eba7e95e68f6fc05b07dec15fb1e553e1b

2 years agoUpdate clippy for associated item changes
Matthew Jasper [Thu, 18 Nov 2021 22:33:49 +0000 (22:33 +0000)]
Update clippy for associated item changes

2 years agoAdd query to avoid name comparison in `leaf_def`
Matthew Jasper [Thu, 18 Nov 2021 22:29:07 +0000 (22:29 +0000)]
Add query to avoid name comparison in `leaf_def`

2 years agoMove associated_item* providers to their own module
Matthew Jasper [Thu, 18 Nov 2021 21:44:45 +0000 (21:44 +0000)]
Move associated_item* providers to their own module

2 years agoImplement `TryFrom<char>` for `u8`
Ian Douglas Scott [Wed, 28 Apr 2021 04:05:26 +0000 (21:05 -0700)]
Implement `TryFrom<char>` for `u8`

Previously suggested in https://github.com/rust-lang/rfcs/issues/2854.

It makes sense to have this since `char` implements `From<u8>`. Likewise
`u32`, `u64`, and `u128` (since #79502) implement `From<char>`.

2 years agoAdd `trait_item_def_id` to `AssocItem`
Matthew Jasper [Thu, 18 Nov 2021 21:35:42 +0000 (21:35 +0000)]
Add `trait_item_def_id` to `AssocItem`

This allows avoiding some lookups by name

2 years agoDeserialization less in associated_item_def_ids
Matthew Jasper [Thu, 18 Nov 2021 20:59:12 +0000 (20:59 +0000)]
Deserialization less in associated_item_def_ids

2 years agoConsolidate checking for msvc when generating debuginfo
Wesley Wiser [Tue, 28 Dec 2021 21:57:18 +0000 (16:57 -0500)]
Consolidate checking for msvc when generating debuginfo

If the target we're generating code for is msvc, then we do two main
things differently: we generate type names in a C++ style instead of a
Rust style and we generate debuginfo for enums differently.

I've refactored the code so that there is one function
(`cpp_like_debuginfo`) which determines if we should use the C++ style
of naming types and other debuginfo generation or the regular Rust one.