]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #92743 - bjorn3:less_symbol_intern, r=camelid
Matthias Krüger [Sat, 15 Jan 2022 01:25:17 +0000 (02:25 +0100)]
Rollup merge of #92743 - bjorn3:less_symbol_intern, r=camelid

Use pre-interned symbols in a couple of places

Re-open of https://github.com/rust-lang/rust/pull/92733 as bors glitched.

2 years agoRollup merge of #92684 - ibraheemdev:patch-10, r=m-ou-se
Matthias Krüger [Sat, 15 Jan 2022 01:25:16 +0000 (02:25 +0100)]
Rollup merge of #92684 - ibraheemdev:patch-10, r=m-ou-se

Export `tcp::IntoIncoming`

Added in #88339 but not publicly exported.

2 years agoRollup merge of #92625 - inquisitivecrystal:mirbug-caller, r=michaelwoerister
Matthias Krüger [Sat, 15 Jan 2022 01:25:15 +0000 (02:25 +0100)]
Rollup merge of #92625 - inquisitivecrystal:mirbug-caller, r=michaelwoerister

Add `#[track_caller]` to `mirbug`

When a "'no errors encountered even though `delay_span_bug` issued" error results from the `mirbug` function, the file location information points to the `mirbug` function itself, rather than its caller. This doesn't make sense, since the caller is the real source of the bug. Adding `#[track_caller]` will produce diagnostics that are more useful to anyone fixing the ICE.

2 years agoRollup merge of #92382 - clarfonthey:const_convert, r=scottmcm
Matthias Krüger [Sat, 15 Jan 2022 01:25:14 +0000 (02:25 +0100)]
Rollup merge of #92382 - clarfonthey:const_convert, r=scottmcm

Extend const_convert to rest of blanket core::convert impls

This adds constness to all the blanket impls in `core::convert` under the existing `const_convert` feature, tracked by #88674.

Existing impls under that feature:

```rust
impl<T> const From<T> for T;
impl<T, U> const Into<U> for T where U: ~const From<T>;

impl<T> const ops::Try for Option<T>;
impl<T> const ops::FromResidual for Option<T>;

impl<T, E> const ops::Try for Result<T, E>;
impl<T, E, F> const ops::FromResidual<Result<convert::Infallible, E>> for Result<T, F> where F: ~const From<E>;
```

Additional impls:

```rust
impl<T: ?Sized, U: ?Sized> const AsRef<U> for &T where T: ~const AsRef<U>;
impl<T: ?Sized, U: ?Sized> const AsRef<U> for &mut T where T: ~const AsRef<U>;
impl<T: ?Sized, U: ?Sized> const AsMut<U> for &mut T where T: ~const AsMut<U>;

impl<T, U> const TryInto<U> for T where U: ~const TryFrom<T>;
impl<T, U> const TryFrom<U> for T where U: ~const Into<T>;
```

2 years agoRollup merge of #92191 - jackh726:issue-89352, r=nikomatsakis
Matthias Krüger [Sat, 15 Jan 2022 01:25:14 +0000 (02:25 +0100)]
Rollup merge of #92191 - jackh726:issue-89352, r=nikomatsakis

Prefer projection candidates instead of param_env candidates for Sized predicates

Fixes #89352

Also includes some drive by logging and verbose printing changes that I found useful when debugging this, but I can remove this if needed.

This is a little hacky - but imo no more than the rest of `candidate_should_be_dropped_in_favor_of`. Importantly, in a Chalk-like world, both candidates should be completely compatible.

r? ```@nikomatsakis```

2 years agoAuto merge of #91948 - nnethercote:rustdoc-more-Symbols, r=GuillaumeGomez
bors [Fri, 14 Jan 2022 20:34:18 +0000 (20:34 +0000)]
Auto merge of #91948 - nnethercote:rustdoc-more-Symbols, r=GuillaumeGomez

rustdoc: avoid many `Symbol` to `String` conversions.

Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.

r? `@GuillaumeGomez`

2 years agoDocument and test `UrlPartsBuilder::push_fmt`
Noah Lev [Mon, 10 Jan 2022 23:33:20 +0000 (15:33 -0800)]
Document and test `UrlPartsBuilder::push_fmt`

2 years agoMake `AVG_PART_LENGTH` a power of 2
Noah Lev [Mon, 10 Jan 2022 20:24:20 +0000 (12:24 -0800)]
Make `AVG_PART_LENGTH` a power of 2

I seem to recall that in general, it's best to request an allocation
with a size that's a power of 2. The low estimate of 5 was probably a
little too low as well.

2 years agoEstimate path length instead of hardcoding 64 bytes
Noah Lev [Mon, 10 Jan 2022 20:23:58 +0000 (12:23 -0800)]
Estimate path length instead of hardcoding 64 bytes

2 years agoUse UrlPartsBuilder and remove `join_with_slash`
Noah Lev [Mon, 10 Jan 2022 20:18:26 +0000 (12:18 -0800)]
Use UrlPartsBuilder and remove `join_with_slash`

2 years agorustdoc: remove some unnecessary sigils.
Nicholas Nethercote [Wed, 15 Dec 2021 00:14:21 +0000 (11:14 +1100)]
rustdoc: remove some unnecessary sigils.

2 years agorustdoc: remove many unnecessary `.as_ref()` calls.
Nicholas Nethercote [Tue, 14 Dec 2021 23:01:08 +0000 (10:01 +1100)]
rustdoc: remove many unnecessary `.as_ref()` calls.

2 years agorustdoc: avoid many `Symbol` to `String` conversions.
Nicholas Nethercote [Tue, 14 Dec 2021 19:18:18 +0000 (06:18 +1100)]
rustdoc: avoid many `Symbol` to `String` conversions.

Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.

2 years agoAuto merge of #92883 - matthiaskrgr:rollup-uoudywx, r=matthiaskrgr
bors [Fri, 14 Jan 2022 17:31:28 +0000 (17:31 +0000)]
Auto merge of #92883 - matthiaskrgr:rollup-uoudywx, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #92045 (Don't fall back to crate-level opaque type definitions.)
 - #92381 (Suggest `return`ing tail expressions in async functions)
 - #92768 (Partially stabilize `maybe_uninit_extra`)
 - #92810 (Deduplicate box deref and regular deref suggestions)
 - #92818 (Update documentation for doc_cfg feature)
 - #92840 (Fix some lints documentation)
 - #92849 (Clippyup)
 - #92854 (Use the updated Rust logo in rustdoc)
 - #92864 (Fix a missing dot in the main item heading)

Failed merges:

 - #92838 (Clean up some links in RELEASES)

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

2 years agoAuto merge of #92681 - Aaron1011:task-deps-ref, r=cjgillot
bors [Fri, 14 Jan 2022 14:20:17 +0000 (14:20 +0000)]
Auto merge of #92681 - Aaron1011:task-deps-ref, r=cjgillot

Introduce new `TaskDepsRef` enum to track allow/ignore/forbid status

2 years agoRollup merge of #92864 - Urgau:fix-missing-source-dot, r=jsha
Matthias Krüger [Fri, 14 Jan 2022 06:47:39 +0000 (07:47 +0100)]
Rollup merge of #92864 - Urgau:fix-missing-source-dot, r=jsha

Fix a missing dot in the main item heading

This pull-request fix a missing `·` in the item header ~~and also make use of `&nbsp;` to explicit that the spaces are mandatory~~.

| Before | After |
| --- | --- |
| ![image](https://user-images.githubusercontent.com/3616612/149393966-7cca6dc5-9a62-47fa-8c9c-18f936d43aa9.png) | ![image](https://user-images.githubusercontent.com/3616612/149393869-5ffd6e44-d91c-4ece-b69e-d103304f6626.png) |

PS: This was introduce yesterday by https://github.com/rust-lang/rust/pull/92526 (the migration from Tera to Askama) and is not currently observable in the nightly doc.

2 years agoRollup merge of #92854 - Urgau:better-rust-logo, r=GuillaumeGomez
Matthias Krüger [Fri, 14 Jan 2022 06:47:38 +0000 (07:47 +0100)]
Rollup merge of #92854 - Urgau:better-rust-logo, r=GuillaumeGomez

Use the updated Rust logo in rustdoc

This pull-request use the updated Rust logo from https://github.com/rust-lang/rust-artwork/pull/9 and also change the logo format from PNG to SVG.

| Before | After |
| --- | --- |
| ![Screenshot 2022-01-13 at 14-33-40 std - Rust](https://user-images.githubusercontent.com/3616612/149342697-7afe4c3e-2be5-444b-86f3-118712b4f7ae.png) | ![Screenshot 2022-01-13 at 14-33-15 std - Rust](https://user-images.githubusercontent.com/3616612/149342705-54ed27c6-0806-4c2d-baa1-4d65ed897e2b.png) |

I also took the liberty to update the two PNG favicons with the SVG reducing their size by ~35% each.

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

r? ```@jsha```

2 years agoRollup merge of #92849 - flip1995:clippyup, r=Manishearth
Matthias Krüger [Fri, 14 Jan 2022 06:47:37 +0000 (07:47 +0100)]
Rollup merge of #92849 - flip1995:clippyup, r=Manishearth

Clippyup

r? ```@Manishearth```

2 years agoRollup merge of #92840 - hafeoz:master, r=ehuss
Matthias Krüger [Fri, 14 Jan 2022 06:47:36 +0000 (07:47 +0100)]
Rollup merge of #92840 - hafeoz:master, r=ehuss

Fix some lints documentation

Several lints documentation failed to show the output of the example (mostly due to `ignore` attribute):

- [irrefutable_let_patterns](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#irrefutable-let-patterns)
- [asm_sub_register](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#asm-sub-register)
- [bad_asm_style](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#bad-asm-style)
- [ineffective_unstable_trait_impl](https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#ineffective-unstable-trait-impl)
- duplicate_macro_attributes

This pull request fixes these lints output so that they can be displayed properly.

2 years agoRollup merge of #92818 - GuillaumeGomez:update-doc-cfg-doc, r=camelid
Matthias Krüger [Fri, 14 Jan 2022 06:47:35 +0000 (07:47 +0100)]
Rollup merge of #92818 - GuillaumeGomez:update-doc-cfg-doc, r=camelid

Update documentation for doc_cfg feature

Fixes  #92484.

2 years agoRollup merge of #92810 - compiler-errors:deduplicate-box-deref-suggestion, r=camelid
Matthias Krüger [Fri, 14 Jan 2022 06:47:34 +0000 (07:47 +0100)]
Rollup merge of #92810 - compiler-errors:deduplicate-box-deref-suggestion, r=camelid

Deduplicate box deref and regular deref suggestions

Remove the suggestion code special-cased for Box deref.

r? ```@camelid```
since you introduced the code in #90627

2 years agoRollup merge of #92768 - ojeda:stabilize-maybe_uninit_extra, r=Mark-Simulacrum
Matthias Krüger [Fri, 14 Jan 2022 06:47:33 +0000 (07:47 +0100)]
Rollup merge of #92768 - ojeda:stabilize-maybe_uninit_extra, r=Mark-Simulacrum

Partially stabilize `maybe_uninit_extra`

This covers:

```rust
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 agoRollup merge of #92381 - ThePuzzlemaker:issue-92308, r=estebank
Matthias Krüger [Fri, 14 Jan 2022 06:47:32 +0000 (07:47 +0100)]
Rollup merge of #92381 - ThePuzzlemaker:issue-92308, r=estebank

Suggest `return`ing tail expressions in async functions

This PR fixes #92308.

Previously, the suggestion to `return` tail expressions (introduced in #81769) did not apply to `async` functions, as the suggestion checked whether the types were equal disregarding `impl Future<Output = T>` syntax sugar for `async` functions. This PR changes that in order to fix a potential papercut.

I'm not sure if this is the "right" way to do this, so if there is a better way then please let me know.

I amended an existing test introduced in #81769 to add a regression test for this, if you think I should make a separate test I will.

2 years agoRollup merge of #92045 - oli-obk:cleanup, r=petrochenkov
Matthias Krüger [Fri, 14 Jan 2022 06:47:31 +0000 (07:47 +0100)]
Rollup merge of #92045 - oli-obk:cleanup, r=petrochenkov

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.

Only works after #90948 which worked by accident for our entire test suite.

2 years agoAuto merge of #92781 - lambinoo:I-92755-no-mir-missing-reachable, r=petrochenkov
bors [Fri, 14 Jan 2022 06:29:32 +0000 (06:29 +0000)]
Auto merge of #92781 - lambinoo:I-92755-no-mir-missing-reachable, r=petrochenkov

Set struct/union/enum fields/variants as reachable when item is

Fixes #92755

2 years agoAuto merge of #92844 - matthiaskrgr:rollup-z5wb6yi, r=matthiaskrgr
bors [Fri, 14 Jan 2022 03:17:11 +0000 (03:17 +0000)]
Auto merge of #92844 - matthiaskrgr:rollup-z5wb6yi, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #90001 (Make rlib metadata strip works with MIPSr6 architecture)
 - #91687 (rustdoc: do not emit tuple variant fields if none are documented)
 - #91938 (Add `std::error::Report` type)
 - #92006 (Welcome opaque types into the fold)
 - #92142 ([code coverage] Fix missing dead code in modules that are never called)
 - #92277 (rustc_metadata: Stop passing `CrateMetadataRef` by reference (step 1))
 - #92334 (rustdoc: Preserve rendering of macro_rules matchers when possible)
 - #92807 (Update cargo)
 - #92832 (Update RELEASES for 1.58.)

Failed merges:

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

2 years agofix: set struct/union/enum fields/variants as reachable when item is
Lamb [Tue, 11 Jan 2022 20:09:31 +0000 (20:09 +0000)]
fix: set struct/union/enum fields/variants as reachable when item is

2 years agofix stability attribute for `tcp::IntoIncoming`
Ibraheem Ahmed [Thu, 13 Jan 2022 21:04:02 +0000 (16:04 -0500)]
fix stability attribute for `tcp::IntoIncoming`

2 years agoUpdate documentation for doc_cfg
Guillaume Gomez [Wed, 12 Jan 2022 17:20:11 +0000 (18:20 +0100)]
Update documentation for doc_cfg

2 years agoFix and improve missing dot in the item heading
lolo.branstett@numericable.fr [Thu, 13 Jan 2022 19:05:44 +0000 (20:05 +0100)]
Fix and improve missing dot in the item heading

2 years agoAuto merge of #89861 - nbdd0121:closure, r=wesleywiser
bors [Thu, 13 Jan 2022 18:51:07 +0000 (18:51 +0000)]
Auto merge of #89861 - nbdd0121:closure, r=wesleywiser

Closure capture cleanup & refactor

Follow up of #89648

Each commit is self-contained and the rationale/changes are documented in the commit message, so it's advisable to review commit by commit.

The code is significantly cleaner (at least IMO), but that could have some perf implication, so I'd suggest a perf run.

r? `@wesleywiser`
cc `@arora-aman`

2 years agoRemove `asm` feature from lints example
hafeoz [Thu, 13 Jan 2022 15:58:58 +0000 (15:58 +0000)]
Remove `asm` feature from lints example

2 years agoRegenerate the PNGs favicon with the updated Rust logo
Loïc BRANSTETT [Thu, 13 Jan 2022 13:45:10 +0000 (14:45 +0100)]
Regenerate the PNGs favicon with the updated Rust logo

2 years agoUse the updated Rust logo and change it's format to SVG
Loïc BRANSTETT [Thu, 13 Jan 2022 13:44:30 +0000 (14:44 +0100)]
Use the updated Rust logo and change it's format to SVG

2 years agoFix Clippy sync fallout
flip1995 [Thu, 13 Jan 2022 12:37:24 +0000 (13:37 +0100)]
Fix Clippy sync fallout

2 years agoUpdate Cargo.lock
flip1995 [Thu, 13 Jan 2022 12:18:51 +0000 (13:18 +0100)]
Update Cargo.lock

2 years agoMerge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyup
flip1995 [Thu, 13 Jan 2022 12:18:19 +0000 (13:18 +0100)]
Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyup

2 years agoAuto merge of #8272 - flip1995:rustup, r=flip1995
bors [Thu, 13 Jan 2022 11:55:36 +0000 (11:55 +0000)]
Auto merge of #8272 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2022-01-13
flip1995 [Thu, 13 Jan 2022 11:48:17 +0000 (12:48 +0100)]
Bump nightly version -> 2022-01-13

2 years agoBump Clippy Version -> 0.1.60
flip1995 [Thu, 13 Jan 2022 11:48:08 +0000 (12:48 +0100)]
Bump Clippy Version -> 0.1.60

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 13 Jan 2022 11:11:21 +0000 (12:11 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoRollup merge of #92832 - ehuss:1.58-releases, r=Mark-Simulacrum
Matthias Krüger [Thu, 13 Jan 2022 07:11:23 +0000 (08:11 +0100)]
Rollup merge of #92832 - ehuss:1.58-releases, r=Mark-Simulacrum

Update RELEASES for 1.58.

From what I can tell:

* `NonZero{unsigned}::is_power_of_two` was stabilized in 1.59: https://github.com/rust-lang/rust/pull/91301
* `MaybeUninit` const was added in 1.59: https://github.com/rust-lang/rust/pull/90896

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