]> git.lizzy.rs Git - rust.git/log
rust.git
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 ago`README`: mention `clippy-driver` on usage list
Miguel Ojeda [Tue, 14 Dec 2021 17:13:14 +0000 (18:13 +0100)]
`README`: mention `clippy-driver` on usage list

Removes the "compiled from source" bit, which is confusing.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years ago`README`: `clippy-driver` is not a replacement for `rustc`
Miguel Ojeda [Sat, 27 Nov 2021 16:10:19 +0000 (17:10 +0100)]
`README`: `clippy-driver` is not a replacement for `rustc`

Currently, `clippy-driver` may run codegen, but this is an
implementation detail.

See https://github.com/rust-lang/rust-clippy/issues/8035.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
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 agoAdd borrow_as_ptr lint
Federico Guerinoni [Sun, 2 Jan 2022 13:26:44 +0000 (14:26 +0100)]
Add borrow_as_ptr lint

Closes: #6995
Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
Co-authored-by: Paolo Barbolini <paolo@paolo565.org>
2 years agoAuto merge of #8260 - taiki-e:mutex_atomic, r=llogiq
bors [Tue, 11 Jan 2022 08:09:11 +0000 (08:09 +0000)]
Auto merge of #8260 - taiki-e:mutex_atomic, r=llogiq

Downgrade mutex_atomic to nursery

See #1516 and #4295.

There are suggestions about removing this lint from the default warned lints in both issues.
Also, [`mutex_integer`](https://rust-lang.github.io/rust-clippy/master/index.html#mutex_integer) lint that has the same problems as this lint is in `nursery` group.

changelog: Moved [`mutex_atomic`] to `nursery`

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 agoFix dogfood
Cameron Steffen [Mon, 10 Jan 2022 23:47:56 +0000 (17:47 -0600)]
Fix dogfood

2 years agoAuto merge of #8261 - taiki-e:disallowed, r=giraffate
bors [Mon, 10 Jan 2022 23:51:39 +0000 (23:51 +0000)]
Auto merge of #8261 - taiki-e:disallowed, r=giraffate

Warn disallowed_methods and disallowed_types by default

Closes #7841

changelog: Moved [`disallowed_methods`] and [`disallowed_types`] to `style`

2 years agoRemove rustfmt component check
Cameron Steffen [Mon, 10 Jan 2022 20:05:38 +0000 (14:05 -0600)]
Remove rustfmt component check

This was more valuable when we used the latest nightly without
specifying the toolchain version.

2 years agoMerge dogfood tests
Cameron Steffen [Mon, 10 Jan 2022 20:03:55 +0000 (14:03 -0600)]
Merge dogfood tests

The two dogfood tests cannot be run concurrently since they use the same
target directory.

2 years agoMove workspace test
Cameron Steffen [Mon, 10 Jan 2022 21:27:00 +0000 (15:27 -0600)]
Move workspace test

2 years agoUse `rustup which rustfmt`
Cameron Steffen [Mon, 10 Jan 2022 19:53:02 +0000 (13:53 -0600)]
Use `rustup which rustfmt`

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 agoRefactor test utils
Cameron Steffen [Mon, 10 Jan 2022 19:20:46 +0000 (13:20 -0600)]
Refactor test utils

2 years agoFix output capturing
Cameron Steffen [Mon, 10 Jan 2022 20:30:45 +0000 (14:30 -0600)]
Fix output capturing

2 years agoRun dogfood on windows
Cameron Steffen [Mon, 10 Jan 2022 17:05:05 +0000 (11:05 -0600)]
Run dogfood on windows

I believe this is possible as of rust-lang/rust-clippy#7631

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 agoWarn disallowed_methods and disallowed_types by default
Taiki Endo [Mon, 10 Jan 2022 17:17:14 +0000 (02:17 +0900)]
Warn disallowed_methods and disallowed_types by default

2 years agoUse pre-interned symbols in a couple of places
bjorn3 [Mon, 10 Jan 2022 16:08:21 +0000 (17:08 +0100)]
Use pre-interned symbols in a couple of places

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 agoIgnore `unused_mod.rs` file in code coverage results
Wesley Wiser [Mon, 10 Jan 2022 14:55:52 +0000 (09:55 -0500)]
Ignore `unused_mod.rs` file in code coverage results

As discussed in
https://github.com/rust-lang/rust/pull/92142#issuecomment-1008239473,
tests that contain multiple files order their results differently on
Windows and Linux which the test runner currently can't handle
correctly. For now, ignore the "bin" part of the test and only include
the unused library dependency which is what the test really cares about
anyway.

2 years agoDowngrade mutex_atomic to nursery
Taiki Endo [Mon, 10 Jan 2022 14:36:13 +0000 (23:36 +0900)]
Downgrade mutex_atomic to nursery

2 years agoAuto merge of #8228 - Jarcho:iter_not_returning_iterator_8225, r=giraffate
bors [Mon, 10 Jan 2022 12:34:15 +0000 (12:34 +0000)]
Auto merge of #8228 - Jarcho:iter_not_returning_iterator_8225, r=giraffate

fix `iter_not_returning_iterator`

fixes #8225

changelog: Handle type projections in `iter_not_returning_iterator`
changelog: Don't lint `iter_not_returning_iterator` in trait implementations
changelog: Lint `iter_not_returning_iterator` in trait definitions

2 years agoAuto merge of #8257 - camsteffen:internal-features, r=giraffate
bors [Mon, 10 Jan 2022 12:18:05 +0000 (12:18 +0000)]
Auto merge of #8257 - camsteffen:internal-features, r=giraffate

Combine internal cargo features

changelog: none

This is just simpler and I don't see any downsides.

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 agoAuto merge of #8252 - dswij:8229, r=xFrednet
bors [Mon, 10 Jan 2022 10:31:59 +0000 (10:31 +0000)]
Auto merge of #8252 - dswij:8229, r=xFrednet

cover trait for `trait_duplication_in_bounds`

closes #8229

changelog: [`trait_duplication_in_bounds`] covers trait functions with `Self` bounds

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 ago`trait_duplication_in_bounds` Update description and add test
dswij [Mon, 10 Jan 2022 04:45:01 +0000 (12:45 +0800)]
`trait_duplication_in_bounds` Update description and add test

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 agoCombine internal features in clippy_lints
Cameron Steffen [Mon, 10 Jan 2022 00:22:38 +0000 (18:22 -0600)]
Combine internal features in clippy_lints

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 agoCombine internal features in clippy_utils
Cameron Steffen [Mon, 10 Jan 2022 00:16:05 +0000 (18:16 -0600)]
Combine internal features in clippy_utils

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 #8236 - PatchMixolydic:single_char_lifetime_names, r=llogiq
bors [Sun, 9 Jan 2022 14:27:36 +0000 (14:27 +0000)]
Auto merge of #8236 - PatchMixolydic:single_char_lifetime_names, r=llogiq

new lint: `single_char_lifetime_names`

This pull request adds a lint against single character lifetime names, as they might not divulge enough information about the purpose of the lifetime. This can make code harder to understand. I placed this in `restriction` rather than `pedantic` (as suggested in #8233) since most of the Rust ecosystem already uses single character lifetime names (to my knowledge, at least) and since single character lifetime names aren't incorrect. I'd be happy to change this upon request, however. Fixes #8233.

- [x] Followed lint naming conventions
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `cargo dev update_lints`
- [x] Added lint documentation
- [x] Run `cargo dev fmt`

changelog: new lint: [`single_char_lifetime_names`]

2 years agonew lint: `single_char_lifetime_names`
bors [Sun, 9 Jan 2022 14:27:36 +0000 (14:27 +0000)]
new lint: `single_char_lifetime_names`

This pull request adds a lint against single character lifetime names, as they might not divulge enough information about the purpose of the lifetime. This can make code harder to understand. I placed this in `restriction` rather than `pedantic` (as suggested in #8233) since most of the Rust ecosystem already uses single character lifetime names (to my knowledge, at least) and since single character lifetime names aren't incorrect. I'd be happy to change this upon request, however. Fixes #8233.

- [x] Followed lint naming conventions
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `cargo dev update_lints`
- [x] Added lint documentation
- [x] Run `cargo dev fmt`

changelog: new lint: [`single_char_lifetime_names`]

2 years agorustc_metadata: Stop passing `CrateMetadataRef` by reference
Vadim Petrochenkov [Fri, 24 Dec 2021 06:34:30 +0000 (14:34 +0800)]
rustc_metadata: Stop passing `CrateMetadataRef` by reference

It's already a (fat) reference.
Double referencing it creates lifetime issues for its methods that want to return iterators.

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 agocover trait for `trait_duplication_in_bounds`
dswij [Thu, 6 Jan 2022 10:43:44 +0000 (18:43 +0800)]
cover trait for `trait_duplication_in_bounds`

2 years agoexport `tcp::IntoIncoming`
Ibraheem Ahmed [Sun, 9 Jan 2022 04:48:50 +0000 (23:48 -0500)]
export `tcp::IntoIncoming`

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: 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 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 #8249 - sourcefrog:depinfo, r=Manishearth
bors [Sun, 9 Jan 2022 00:19:19 +0000 (00:19 +0000)]
Auto merge of #8249 - sourcefrog:depinfo, r=Manishearth

Set binary-dep-depinfo in .cargo/config.toml

Fixes #8248

According to https://doc.rust-lang.org/cargo/reference/unstable this
seems to be the right place to set it, and it does fix the build for me.

I haven't removed the other `rustflags` because perhaps it's needed on
different cargo/rust versions?

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: none

2 years agoIntroduce new `TaskDepsRef` enum to track allow/ignore/forbid status
Aaron Hill [Sat, 8 Jan 2022 23:22:06 +0000 (18:22 -0500)]
Introduce new `TaskDepsRef` enum to track allow/ignore/forbid status

2 years agoSet binary-dep-depinfo in .cargo/config.toml
Martin Pool [Sat, 8 Jan 2022 22:12:53 +0000 (14:12 -0800)]
Set binary-dep-depinfo in .cargo/config.toml

Fixes #8248

According to https://doc.rust-lang.org/cargo/reference/unstable this
seems to be the right place to set it, and it does fix the build for me.

I haven't removed the other `rustflags` because perhaps it's needed on
different cargo/rust versions?

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 #8201 - smoelius:master, r=camsteffen
bors [Sat, 8 Jan 2022 16:33:48 +0000 (16:33 +0000)]
Auto merge of #8201 - smoelius:master, r=camsteffen

Change `unnecessary_to_owned` `into_iter` suggestions to `MaybeIncorrect`

I am having a hard time finding a good solution for #8148, so I am wondering if is enough to just change the suggestion's applicability to `MaybeIncorrect`?

I apologize, as I realize this is a bit of a cop out.

changelog: none

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 agoAdd `unnecessary_to_owned` "Known problems" section
Samuel E. Moelius III [Sat, 8 Jan 2022 14:09:52 +0000 (09:09 -0500)]
Add `unnecessary_to_owned` "Known problems" section

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 agotidy: add `ahash` to permitted dep list
Lain Yang [Sat, 8 Jan 2022 08:27:58 +0000 (16:27 +0800)]
tidy: add `ahash` to permitted dep list

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