]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #92807 - ehuss:update-cargo, r=ehuss
Matthias Krüger [Thu, 13 Jan 2022 07:11:22 +0000 (08:11 +0100)]
Rollup merge of #92807 - ehuss:update-cargo, r=ehuss

Update cargo

6 commits in 358e79fe56fe374649275ca7aebaafd57ade0e8d..06b9d31743210b788b130c8a484c2838afa6fc27
2022-01-04 18:39:45 +0000 to 2022-01-11 23:47:29 +0000
- Port cargo to clap3 (rust-lang/cargo#10265)
- feat: support rustflags per profile (rust-lang/cargo#10217)
- Make bors ignore the PR template so it doesn't end up in merge messages (rust-lang/cargo#10267)
- Be resilient to most IO error and filesystem loop while walking dirs (rust-lang/cargo#10214)
- Remove the option to disable pipelining (rust-lang/cargo#10258)
- Always ask rustc for messages about artifacts, and always process them (rust-lang/cargo#10255)

2 years agoRollup merge of #92334 - dtolnay:rustdocmatcher, r=camelid,GuillaumeGomez
Matthias Krüger [Thu, 13 Jan 2022 07:11:22 +0000 (08:11 +0100)]
Rollup merge of #92334 - dtolnay:rustdocmatcher, r=camelid,GuillaumeGomez

rustdoc: Preserve rendering of macro_rules matchers when possible

Fixes #92331. This approach restores the behavior prior to #86282 **if** the matcher token held by the compiler **and** the matcher token found in the source code are identical TokenTrees. Thus #86208 remains fixed, but without regressing formatting for the vast majority of macros which are not macro-generated.

2 years agoRollup merge of #92277 - petrochenkov:cmrval2, r=jackh726
Matthias Krüger [Thu, 13 Jan 2022 07:11:21 +0000 (08:11 +0100)]
Rollup merge of #92277 - petrochenkov:cmrval2, r=jackh726

rustc_metadata: Stop passing `CrateMetadataRef` by reference (step 1)

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

---
Extracted from https://github.com/rust-lang/rust/pull/92245 for a perf run.
The PR changes a lot of symbol names due to function signature changes, so it's hard to do differential profiling, let's spend some machine time instead.

2 years agoRollup merge of #92142 - wesleywiser:fix_codecoverage_partitioning, r=tmandry
Matthias Krüger [Thu, 13 Jan 2022 07:11:20 +0000 (08:11 +0100)]
Rollup merge of #92142 - wesleywiser:fix_codecoverage_partitioning, r=tmandry

[code coverage] Fix missing dead code in modules that are never called

The issue here is that the logic used to determine which CGU to put the dead function stubs in doesn't handle cases where a module is never assigned to a CGU (which is what happens when all of the code in the module is dead).

The partitioning logic also caused issues in #85461 where inline functions were duplicated into multiple CGUs resulting in duplicate symbols.

This commit fixes the issue by removing the complex logic used to assign dead code stubs to CGUs and replaces it with a much simpler model: we pick one CGU to hold all the dead code stubs. We pick a CGU which has exported items which increases the likelihood the linker won't throw away our dead functions and we pick the smallest to minimize the impact on compilation times for crates with very large CGUs.

Fixes #91661
Fixes #86177
Fixes #85718
Fixes #79622

r? ```@tmandry```
cc ```@richkadel```

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

2 years agoRollup merge of #92006 - oli-obk:welcome_opaque_types_into_the_fold, r=nikomatsakis
Matthias Krüger [Thu, 13 Jan 2022 07:11:19 +0000 (08:11 +0100)]
Rollup merge of #92006 - oli-obk:welcome_opaque_types_into_the_fold, r=nikomatsakis

Welcome opaque types into the fold

r? ```@nikomatsakis``` because idk who else to bug on the type_op changes

The commits have explanations in them. The TLDR is that

5c4600227329a273c0c6c844e4a10ce650ead601 stops the "recurse and replace" scheme that replaces opaque types with their canonical inference var by just doing that ahead of time
bdeeb07bf6400622074f04ca2523dac1512ab662 does not affect anything on master afaict, but since opaque types generate obligations when instantiated, and lazy TAIT instantiates opaque types *everywhere*, we need to properly handle obligations here instead of just hoping no problematic obligations ever come up.

2 years agoRollup merge of #91938 - yaahc:error-reporter, r=m-ou-se
Matthias Krüger [Thu, 13 Jan 2022 07:11:18 +0000 (08:11 +0100)]
Rollup merge of #91938 - yaahc:error-reporter, r=m-ou-se

Add `std::error::Report` type

This is a continuation of https://github.com/rust-lang/rust/pull/90174, split into a separate PR since I cannot push to ```````@seanchen1991``````` 's fork

2 years agoRollup merge of #91687 - euclio:tuple-variant-field-section, r=GuillaumeGomez
Matthias Krüger [Thu, 13 Jan 2022 07:11:17 +0000 (08:11 +0100)]
Rollup merge of #91687 - euclio:tuple-variant-field-section, r=GuillaumeGomez

rustdoc: do not emit tuple variant fields if none are documented

Fixes #90824.

Before:

![2021-12-15T22:26:41](https://user-images.githubusercontent.com/1372438/146302871-4d265433-b9aa-4e53-adfb-e7cb92107180.png)

After:

![2021-12-15T22:27:01](https://user-images.githubusercontent.com/1372438/146302872-e39eda3d-2fb2-4fb9-aae7-2008e4e1b4dd.png)

2 years agoRollup merge of #90001 - Fearyncess:master, r=alexcrichton
Matthias Krüger [Thu, 13 Jan 2022 07:11:16 +0000 (08:11 +0100)]
Rollup merge of #90001 - Fearyncess:master, r=alexcrichton

Make rlib metadata strip works with MIPSr6 architecture

Because MIPSr6 has many differences with previous MIPSr2 arch, the previous rlib metadata stripping code in `rustc_codegen_ssa` is only for MIPSr2/r3/r5 (which share the same elf e_flags).

This commit fixed this problem. It makes `rustc_codegen_ssa` happy when compiling rustc for MIPSr6 target or hosts.

e_flags REF: https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/llvm/include/llvm/BinaryFormat/ELF.h#L562

2 years agoFix lints documents
hafeoz [Thu, 13 Jan 2022 03:57:44 +0000 (03:57 +0000)]
Fix lints documents

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 agoUpdate RELEASES for 1.58.
Eric Huss [Thu, 13 Jan 2022 00:05:30 +0000 (16:05 -0800)]
Update RELEASES for 1.58.

2 years agoBless tests.
Camille GILLOT [Wed, 12 Jan 2022 22:41:28 +0000 (23:41 +0100)]
Bless tests.

2 years agoErr about fn traits in a single place.
Camille GILLOT [Wed, 12 Jan 2022 22:13:52 +0000 (23:13 +0100)]
Err about fn traits in a single place.

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 agosuggest deref/unboxing before wrapping variant
Michael Goulet [Wed, 12 Jan 2022 20:00:36 +0000 (12:00 -0800)]
suggest deref/unboxing before wrapping variant

2 years agoEnsure res and module are consistent with each other.
Camille GILLOT [Wed, 12 Jan 2022 19:04:04 +0000 (20:04 +0100)]
Ensure res and module are consistent with each other.

The `record_used` parameter changes the result, so we must pass the same
value for initial and module resolution.

2 years agoAuto merge of #8226 - Jarcho:manual_memcpy_8160, r=flip1995
bors [Wed, 12 Jan 2022 18:44:34 +0000 (18:44 +0000)]
Auto merge of #8226 - Jarcho:manual_memcpy_8160, r=flip1995

`manual_memcpy` fix

fixes #8160

Ideally this would work with `VecDeque`, but the current interface is unsuitable for it. At a minimum something like `range_as_slices` would be needed.

changelog: Don't lint `manual_memcpy` on `VecDeque`
changelog: Suggest `copy_from_slice` for `manual_memcpy` when applicable

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 agoAdd `manual_memcpy_test` for `VecDeque`
Jason Newcomb [Wed, 12 Jan 2022 17:33:47 +0000 (12:33 -0500)]
Add `manual_memcpy_test` for `VecDeque`

2 years agoAuto merge of #8266 - camsteffen:test-tweaks, r=flip1995
bors [Wed, 12 Jan 2022 17:19:58 +0000 (17:19 +0000)]
Auto merge of #8266 - camsteffen:test-tweaks, r=flip1995

Some test code cleanup

changelog: none

Mainly moves /clippy_workspace_tests into /tests and combines the two dogfood tests which can't run concurrently.

2 years agoAuto merge of #8265 - camsteffen:which-rustfmt, r=xFrednet
bors [Wed, 12 Jan 2022 17:03:52 +0000 (17:03 +0000)]
Auto merge of #8265 - camsteffen:which-rustfmt, r=xFrednet

Cache rustfmt path

changelog: none

Call `rustup which rustfmt` and use the output. This shaves off  ~0.7 seconds for `cargo dev fmt` for me.

2 years agoOnly run dogfood on linux in CI
Cameron Steffen [Wed, 12 Jan 2022 16:46:05 +0000 (10:46 -0600)]
Only run dogfood on linux in CI

2 years agoAuto merge of #8112 - Alexendoo:disallowed_methods_primitives, r=flip1995
bors [Wed, 12 Jan 2022 16:47:45 +0000 (16:47 +0000)]
Auto merge of #8112 - Alexendoo:disallowed_methods_primitives, r=flip1995

Allow primitive types in disallowed_methods

Fixes #8079

changelog: `disallowed_methods`: Now can disallow methods of primitive types

2 years agoUse method name from conf::DisallowedMethod
Alex Macleod [Thu, 9 Dec 2021 20:42:44 +0000 (20:42 +0000)]
Use method name from conf::DisallowedMethod

Since def_path_str returns e.g. "core::f32::<impl f32>::clamp" for
"f32::clamp"

2 years agoAuto merge of #8213 - paolobarbolini:size-of-as-bits, r=flip1995
bors [Wed, 12 Jan 2022 16:21:14 +0000 (16:21 +0000)]
Auto merge of #8213 - paolobarbolini:size-of-as-bits, r=flip1995

Add `manual_bits` lint

Closes #6670

---

changelog: new lint: [`manual_bits`]

2 years agoResolve primitive impls in clippy_utils::path_to_res
Alex Macleod [Thu, 9 Dec 2021 19:11:40 +0000 (19:11 +0000)]
Resolve primitive impls in clippy_utils::path_to_res

2 years agoAdd manual_bits lint
Paolo Barbolini [Sun, 2 Jan 2022 22:34:10 +0000 (23:34 +0100)]
Add manual_bits lint

2 years agoAuto merge of #8037 - ojeda:doc-codegen-change, r=camsteffen
bors [Wed, 12 Jan 2022 15:11:08 +0000 (15:11 +0000)]
Auto merge of #8037 - ojeda:doc-codegen-change, r=camsteffen

`README`: document that Clippy may change codegen

Currently, Clippy does not guarantee the same codegen will be produced.
Therefore, it should not be used as an universal replacement for `rustc`.

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

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
fixes #8035
changelog: document that Clippy may change codegen

2 years agoAuto merge of #8190 - camsteffen:no-in-band-liftetimes, r=flip1995
bors [Wed, 12 Jan 2022 14:25:11 +0000 (14:25 +0000)]
Auto merge of #8190 - camsteffen:no-in-band-liftetimes, r=flip1995

Stop using `in_band_lifetimes`

Per rust-lang/rust#91867

changelog: none

2 years agoDon't fall back to crate-level opaque type definitions.
Oli Scherer [Wed, 8 Dec 2021 17:44:50 +0000 (17:44 +0000)]
Don't fall back to crate-level opaque type definitions.

That would just hide bugs, as it works accidentally if the opaque type
is defined at the crate level.

2 years agoAuto merge of #8198 - camsteffen:no-method-call-macro, r=flip1995
bors [Wed, 12 Jan 2022 13:59:12 +0000 (13:59 +0000)]
Auto merge of #8198 - camsteffen:no-method-call-macro, r=flip1995

Remove method_call! macro

This is possible now that `SymbolStr` is removed from rustc.

changelog: none

2 years agoAuto merge of #8268 - Jarcho:deref_addrof_8247, r=flip1995
bors [Wed, 12 Jan 2022 13:25:58 +0000 (13:25 +0000)]
Auto merge of #8268 - Jarcho:deref_addrof_8247, r=flip1995

Fix `deref_addrof`

fixes #8247

This would supersede #8259

changelog: Don't lint `deref_addrof` when the dereference and the borrow occur in different contexts

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 agoDon't lint `deref_addrof` when the two operations occur in different expansions
Jason Newcomb [Wed, 12 Jan 2022 05:25:42 +0000 (00:25 -0500)]
Don't lint `deref_addrof` when the two operations occur in different expansions

2 years agoDeduplicate box deref and regular deref suggestions
Michael Goulet [Wed, 12 Jan 2022 04:57:40 +0000 (20:57 -0800)]
Deduplicate box deref and regular deref suggestions

2 years agoUpdate cargo
Eric Huss [Wed, 12 Jan 2022 04:18:29 +0000 (20:18 -0800)]
Update cargo

2 years agorustdoc: do not emit tuple variant fields if none are documented
Andy Russell [Thu, 9 Dec 2021 01:09:17 +0000 (20:09 -0500)]
rustdoc: do not emit tuple variant fields if none are documented

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 agoInline std::os::unix::ffi::OsStringExt methods
Konrad Borowski [Tue, 11 Jan 2022 18:31:36 +0000 (19:31 +0100)]
Inline std::os::unix::ffi::OsStringExt methods

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 agoAuto merge of #8262 - 1nF0rmed:chore-update-borrowed-box-doc, r=camsteffen
bors [Tue, 11 Jan 2022 17:07:50 +0000 (17:07 +0000)]
Auto merge of #8262 - 1nF0rmed:chore-update-borrowed-box-doc, r=camsteffen

Improve documentation for `borrowed-box` lint

fixes #8161

Updates documentation to elaborate more on how removing Box from a function parameter can generalize the function.

changelog: none

2 years agoImprove documentation for `borrowed-box` lint
Pradyumna Rahul [Mon, 10 Jan 2022 16:14:10 +0000 (21:44 +0530)]
Improve documentation for `borrowed-box` lint

2 years agoPartially stabilize `maybe_uninit_extra`
Miguel Ojeda [Tue, 11 Jan 2022 14:46:53 +0000 (15:46 +0100)]
Partially stabilize `maybe_uninit_extra`

This covers:

    impl<T> MaybeUninit<T> {
        pub unsafe fn assume_init_read(&self) -> T { ... }
        pub unsafe fn assume_init_drop(&mut self) { ... }
    }

It does not cover the const-ness of `write` under
`const_maybe_uninit_write` nor the const-ness of
`assume_init_read` (this commit adds
`const_maybe_uninit_assume_init_read` for that).

FCP: https://github.com/rust-lang/rust/issues/63567#issuecomment-958590287.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoAdd test
Deadbeef [Tue, 11 Jan 2022 15:52:24 +0000 (23:52 +0800)]
Add test

2 years agoStop using in_band_lifetimes
Cameron Steffen [Tue, 11 Jan 2022 15:52:23 +0000 (09:52 -0600)]
Stop using in_band_lifetimes

2 years agoAuto merge of #8210 - guerinoni:master, r=Manishearth
bors [Tue, 11 Jan 2022 15:45:50 +0000 (15:45 +0000)]
Auto merge of #8210 - guerinoni:master, r=Manishearth

Add borrow_as_ptr lint

Closes: #6995
- \[x] Followed [lint naming conventions][lint_naming]
- \[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: [`borrow_as_ptr`]

2 years agoUse the new language identifier for Rust in the PDB debug format
Arlo Siemsen [Tue, 11 Jan 2022 15:41:27 +0000 (07:41 -0800)]
Use the new language identifier for Rust in the PDB debug format

Rust currently identifies as MASM (Microsoft Assembler) in the PDB
debug info format on Windows because no identifier was available.

This change pulls in a cherry-pick to Rust's LLVM that includes the
change to use the new identifier for Rust.

https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang

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 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 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 agoUpdate some comments post the side channel removal
Noah Lev [Thu, 6 Jan 2022 23:57:51 +0000 (15:57 -0800)]
Update some comments post the side channel removal

2 years agoExtract functions for two closures
Noah Lev [Thu, 6 Jan 2022 23:22:22 +0000 (15:22 -0800)]
Extract functions for two closures

These closures were quite complex and part of a quite complex function.
The fact that they are closures makes mistakes likely when refactoring.
For example, earlier, I meant to use `resolved`, an argument of the
closure, but I instead typed `res`, which captured a local variable and
caused a subtle bug that led to a confusing test failure.

Extracting them as functions makes the code easier to understand and
refactor.

2 years agoUpdate comment and make code clearer
Noah Lev [Thu, 6 Jan 2022 23:06:35 +0000 (15:06 -0800)]
Update comment and make code clearer

I'm still not sure why this hack works so seemingly well.

2 years agoRemove unnecessary conditional for suggesting disambiguator
Noah Lev [Thu, 6 Jan 2022 22:45:23 +0000 (14:45 -0800)]
Remove unnecessary conditional for suggesting disambiguator

Now that `res` is used directly, it seems the conditional is
unnecessary.

2 years agoUse Res instead of Disambiguator for `resolved` in `report_mismatch`
Noah Lev [Thu, 6 Jan 2022 22:43:27 +0000 (14:43 -0800)]
Use Res instead of Disambiguator for `resolved` in `report_mismatch`

This allows simplifying a lot of code. It also fixes a subtle bug,
exemplified by the test output changes.

2 years agoAdd test for disambiguator mismatch with crate
Noah Lev [Thu, 6 Jan 2022 22:49:28 +0000 (14:49 -0800)]
Add test for disambiguator mismatch with crate

This currently calls `std` a "crate" in one part of the message and a
"module" in another part. The next commits fix this so it says "crate"
in both places.

2 years agoEnable ignored part of test
Noah Lev [Thu, 6 Jan 2022 22:12:48 +0000 (14:12 -0800)]
Enable ignored part of test

Inherent associated types *are* supported, just unstable.

2 years agoMove two intra-doc-link tests into the `intra-doc` folder
Noah Lev [Thu, 6 Jan 2022 21:59:01 +0000 (13:59 -0800)]
Move two intra-doc-link tests into the `intra-doc` folder

2 years agoRemove hack that is no longer necessary
Noah Lev [Thu, 6 Jan 2022 21:44:46 +0000 (13:44 -0800)]
Remove hack that is no longer necessary

This hack was added in 6ab1f05697c3f2df4e439a05ebcee479a9a16d80.
I don't know what change allowed removing the hack, but that commit
added a test (which I presume covered the hack's behavior), and all
tests are passing with this change. So, I think it should be good.

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 agoSimplify BigNum::bit_length() with log2()
Christopher Swenson [Mon, 10 Jan 2022 23:31:11 +0000 (15:31 -0800)]
Simplify BigNum::bit_length() with log2()

Thank you to @scottmcm for suggesting the handy `log2()` function.

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 agoSimplification of BigNum::bit_length
Christopher Swenson [Mon, 10 Jan 2022 22:18:28 +0000 (14:18 -0800)]
Simplification of BigNum::bit_length

As indicated in the comment, the BigNum::bit_length function could be
optimized by using CLZ, which is often a single instruction instead a
loop.

I think the code is also simpler now without the loop.

I added some additional tests for Big8x3 and Big32x40 to ensure that
there were no regressions.

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 agoUpdate rayon and rustc-rayon
Josh Stone [Mon, 10 Jan 2022 19:34:07 +0000 (11:34 -0800)]
Update rayon and rustc-rayon

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