Commit Graph

160886 Commits

Author SHA1 Message Date
Eric Huss 5b2d5da0d3 Update RELEASES for 1.58. 2022-01-12 16:05:30 -08:00
bors 1bd4fdc943 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 (⬆️ rust-analyzer)
 - #92764 (Fix rust logo style)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-12 17:57:50 +00:00
Matthias Krüger 05dd1e4a2b
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```
2022-01-12 07:12:19 +01:00
Matthias Krüger 8f002a0a83
Rollup merge of #92756 - lnicola:rust-analyzer-2022-01-11, r=lnicola
⬆️ rust-analyzer

r? ```@ghost```
2022-01-12 07:12:17 +01:00
Matthias Krüger a4b808d385
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```
2022-01-12 07:12:16 +01:00
Matthias Krüger 286bb18a9b
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`.
2022-01-12 07:12:15 +01:00
Matthias Krüger bc0a165240
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```
2022-01-12 07:12:15 +01:00
Matthias Krüger eecdfe526f
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.
2022-01-12 07:12:14 +01:00
Matthias Krüger 37f061a2f8
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.
2022-01-12 07:12:13 +01:00
Matthias Krüger 5d904c17f6
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.
2022-01-12 07:12:12 +01:00
Matthias Krüger cfb9306ef9
Rollup merge of #92707 - JohnScience:patch-1, r=GuillaumeGomez
Extended the note on the use of `no_run` attribute
2022-01-12 07:12:11 +01:00
Matthias Krüger 4f31c5c130
Rollup merge of #92703 - joshtriplett:relnotes-file-options, r=pietroalbini
RELEASES.md: Add 1.58 release note for `File::options` stabilization
2022-01-12 07:12:10 +01:00
Matthias Krüger b24b0fdcd0
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```
2022-01-12 07:12:09 +01:00
Matthias Krüger 9ea9e1851d
Rollup merge of #92506 - nico-abram:uwu, r=Mark-Simulacrum
Document Box<T> FFI guarantee in 1.41.0 release notes

Fixes #68676
2022-01-12 07:12:08 +01:00
Matthias Krüger 6726f1e013
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```
2022-01-12 07:12:06 +01:00
Matthias Krüger 677f8f0f4f
Rollup merge of #92328 - camelid:sentence, r=scottmcm
Tweak sentence in `transmute` docs
2022-01-12 07:12:05 +01:00
bors 72e74d7b9c 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`.
2022-01-11 21:02:01 +00:00
bors 1409c015b4 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.
2022-01-11 17:31:07 +00:00
Deadbeef bf5130b502
Add test 2022-01-11 23:52:24 +08:00
Aaron Hill 450ef8613c
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`.
2022-01-11 10:16:22 -05:00
bors 2e2c86eba2 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.
2022-01-11 14:23:24 +00:00
Guillaume Gomez 24c6e963d0 Add GUI test for rust logo style in the sidebars 2022-01-11 13:57:17 +01:00
Guillaume Gomez 9234c0fd52 Fix style for rust logo 2022-01-11 13:42:20 +01:00
bors e4b1d58414 Auto merge of #92012 - llogiq:repr-c-def-id, r=michaelwoerister
Make `DefId` `repr(C)`, optimize big-endian field order

r? `@michaelwoerister`
2022-01-11 08:09:00 +00:00
Laurențiu Nicola 22d4e97d6d ⬆️ rust-analyzer 2022-01-11 07:20:40 +02:00
Yacin Tmimi 11bea2681c 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.
2022-01-10 22:38:15 -05:00
bors 1f213d983d 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
0c99d806ea, 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`
2022-01-11 00:08:23 +00:00
Josh Triplett c91ad5d0f2 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.
2022-01-10 17:35:17 -05:00
unknown fc8af986fd Document Box<T> FFI guarantee in 1.41.0 release notes
Fixes #68676
2022-01-10 17:21:16 -05:00
david-perez 5786bbddc6 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`.
2022-01-10 23:18:34 +01:00
Guillaume Gomez 881b427fa3 Add missing suffix for sidebar-items script path 2022-01-10 21:01:09 +01:00
Wesley Wiser 55abf38bf2 Add note about upstream commit musl-patch-configure.diff is derived from 2022-01-10 10:41:31 -05:00
bors 89b9f7b284 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
2022-01-10 11:53:15 +00:00
Yaroslav Dynnikov 2ae616af30
Fix doc formatting for time.rs
The doc states that instants are not steady, but the word "not" wasn't highlighted in bold.
2022-01-10 14:22:45 +03:00
Matthias Krüger 3d5db0e6b4
Rollup merge of #92717 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/92691
r? `@ghost`
2022-01-10 11:03:12 +01:00
Matthias Krüger 6719e3eb18
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.
2022-01-10 11:03:11 +01:00
Matthias Krüger 80275d66c8
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>
2022-01-10 11:03:09 +01:00
Matthias Krüger ca9fc28f0b
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.
2022-01-10 11:03:07 +01:00
Matthias Krüger a4ac4fae41
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).
2022-01-10 11:03:06 +01:00
Matthias Krüger d20affbf8d
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`
2022-01-10 11:03:05 +01:00
Matthias Krüger 6466f89fc5
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
2022-01-10 11:03:03 +01:00
Ralf Jung c8ff80477e miri 2022-01-10 10:27:34 +01:00
bors df035a33b2 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
2022-01-10 08:55:53 +00:00
Josh Triplett 680ebeaa79 RELEASES.md: Add 1.58 release note for `File::options` stabilization 2022-01-09 20:35:12 -08:00
bors d63a8d965e 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.
2022-01-10 00:26:07 +00:00
Dmitrii - Demenev 8fd8db5c29
Extended the note on the use of `no_run` attribute 2022-01-09 19:17:15 -05:00
Eric Huss 2b7572092c 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.
2022-01-09 13:41:04 -08:00
Lamb 3a77bb86ff 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
2022-01-09 21:33:14 +00:00
Noah Lev 2b70a3df7a 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".
2022-01-09 12:48:28 -08:00
Miguel Ojeda 2d19606d90 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>
2022-01-09 17:04:08 +01:00