]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #92805 - BoxyUwU:revert-lazy-anon-const-substs, r=lcnr
bors [Sun, 16 Jan 2022 11:19:21 +0000 (11:19 +0000)]
Auto merge of #92805 - BoxyUwU:revert-lazy-anon-const-substs, r=lcnr

partially revertish `lazily "compute" anon const default substs`

reverts #87280 except for some of the changes around `ty::Unevaluated` having a visitor and a generic for promoted
why revert: <https://github.com/rust-lang/rust/pull/92805#issuecomment-1010736049>

r? `@lcnr`

2 years agoAuto merge of #92740 - cuviper:update-rayons, r=Mark-Simulacrum
bors [Sun, 16 Jan 2022 08:12:23 +0000 (08:12 +0000)]
Auto merge of #92740 - cuviper:update-rayons, r=Mark-Simulacrum

Update rayon and rustc-rayon

This updates rayon for various tools and rustc-rayon for the compiler's parallel mode.

- rayon v1.3.1 -> v1.5.1
- rayon-core v1.7.1 -> v1.9.1
- rustc-rayon v0.3.1 -> v0.3.2
- rustc-rayon-core v0.3.1 -> v0.3.2

... and indirectly, this updates all of crossbeam-* to their latest versions.

Fixes #92677 by removing crossbeam-queue, but there's still a lingering question about how tidy discovers "runtime" dependencies. None of this is truly in the standard library's dependency tree at all.

2 years agoAuto merge of #92356 - kellerkindt:saturating_int_assign_impl, r=dtolnay
bors [Sun, 16 Jan 2022 05:23:44 +0000 (05:23 +0000)]
Auto merge of #92356 - kellerkindt:saturating_int_assign_impl, r=dtolnay

Add {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}{,Assign}<$t> to Saturat…

Tracking issue #92354

2 years agoAuto merge of #92598 - Badel2:panic-update-hook, r=yaahc
bors [Sun, 16 Jan 2022 02:18:42 +0000 (02:18 +0000)]
Auto merge of #92598 - Badel2:panic-update-hook, r=yaahc

Implement `panic::update_hook`

Add a new function `panic::update_hook` to allow creating panic hooks that forward the call to the previously set panic hook, without race conditions. It works by taking a closure that transforms the old panic hook into a new one, while ensuring that during the execution of the closure no other thread can modify the panic hook. This is a small function so I hope it can be discussed here without a formal RFC, however if you prefer I can write one.

Consider the following example:

```rust
let prev = panic::take_hook();
panic::set_hook(Box::new(move |info| {
    println!("panic handler A");
    prev(info);
}));
```

This is a common pattern in libraries that need to do something in case of panic: log panic to a file, record code coverage, send panic message to a monitoring service, print custom message with link to github to open a new issue, etc. However it is impossible to avoid race conditions with the current API, because two threads can execute in this order:

* Thread A calls `panic::take_hook()`
* Thread B calls `panic::take_hook()`
* Thread A calls `panic::set_hook()`
* Thread B calls `panic::set_hook()`

And the result is that the original panic hook has been lost, as well as the panic hook set by thread A. The resulting panic hook will be the one set by thread B, which forwards to the default panic hook. This is not considered a big issue because the panic handler setup is usually run during initialization code, probably before spawning any other threads.

Using the new `panic::update_hook` function, this race condition is impossible, and the result will be either `A, B, original` or `B, A, original`.

```rust
panic::update_hook(|prev| {
    Box::new(move |info| {
        println!("panic handler A");
        prev(info);
    })
});
```

I found one real world use case here: https://github.com/dtolnay/proc-macro2/blob/988cf403e741aadfd5340bbf67e35e1062a526aa/src/detection.rs#L32 the workaround is to detect the race condition and panic in that case.

The pattern of `take_hook` + `set_hook` is very common, you can see some examples in this pull request, so I think it's natural to have a function that combines them both. Also using `update_hook` instead of `take_hook` + `set_hook` reduces the number of calls to `HOOK_LOCK.write()` from 2 to 1, but I don't expect this to make any difference in performance.

### Unresolved questions:

* `panic::update_hook` takes a closure, if that closure panics the error message is "panicked while processing panic" which is not nice. This is a consequence of holding the `HOOK_LOCK` while executing the closure. Could be avoided using `catch_unwind`?

* Reimplement `panic::set_hook` as `panic::update_hook(|_prev| hook)`?

2 years agoAuto merge of #90146 - cjgillot:no-id-map, r=nagisa
bors [Sat, 15 Jan 2022 23:10:14 +0000 (23:10 +0000)]
Auto merge of #90146 - cjgillot:no-id-map, r=nagisa

Reduce use of LocalDefId <-> HirId maps

This is an attempt to reduce the perf effect of https://github.com/rust-lang/rust/pull/89278.
r? `@ghost`

2 years agoAdd inline.
Camille GILLOT [Fri, 10 Dec 2021 12:23:48 +0000 (13:23 +0100)]
Add inline.

2 years agoDo not ICE when accesing large LocalDefId.
Camille GILLOT [Fri, 22 Oct 2021 14:43:43 +0000 (16:43 +0200)]
Do not ICE when accesing large LocalDefId.

2 years agoReduce use of local_def_id_to_hir_id.
Camille GILLOT [Wed, 20 Oct 2021 18:59:15 +0000 (20:59 +0200)]
Reduce use of local_def_id_to_hir_id.

2 years agoMake ty_param_owner return a LocalDefId.
Camille GILLOT [Sun, 5 Dec 2021 12:09:56 +0000 (13:09 +0100)]
Make ty_param_owner return a LocalDefId.

2 years agoUse LocalDefId in rustc_passes::hir_id_validator.
Camille GILLOT [Sun, 5 Dec 2021 12:08:52 +0000 (13:08 +0100)]
Use LocalDefId in rustc_passes::hir_id_validator.

2 years agoSimplify DefIdForest.
Camille GILLOT [Sun, 5 Dec 2021 12:08:24 +0000 (13:08 +0100)]
Simplify DefIdForest.

2 years agoUse LocalDefId in rustc_passes::entry.
Camille GILLOT [Sun, 5 Dec 2021 12:07:51 +0000 (13:07 +0100)]
Use LocalDefId in rustc_passes::entry.

2 years agoReturn a LocalDefId in get_parent_item.
Camille GILLOT [Thu, 21 Oct 2021 17:41:47 +0000 (19:41 +0200)]
Return a LocalDefId in get_parent_item.

2 years agoAdd fast path to `opt_local_def_id`.
Camille GILLOT [Sun, 5 Dec 2021 10:18:16 +0000 (11:18 +0100)]
Add fast path to `opt_local_def_id`.

2 years agoAuto merge of #92441 - cjgillot:resolve-trait-impl-item, r=matthewjasper
bors [Sat, 15 Jan 2022 14:43:45 +0000 (14:43 +0000)]
Auto merge of #92441 - cjgillot:resolve-trait-impl-item, r=matthewjasper

Link impl items to corresponding trait items in late resolver.

Hygienically linking trait impl items to declarations in the trait can be done directly by the late resolver. In fact, it is already done to diagnose unknown items.

This PR uses this resolution work and stores the `DefId` of the trait item in the HIR. This avoids having to do this resolution manually later.

r? `@matthewjasper`
Related to #90639. The added `trait_item_id` field can be moved to `ImplItemRef` to be used directly by your PR.

2 years agoAuto merge of #92927 - matthiaskrgr:rollup-pgzwfcm, r=matthiaskrgr
bors [Sat, 15 Jan 2022 10:57:03 +0000 (10:57 +0000)]
Auto merge of #92927 - matthiaskrgr:rollup-pgzwfcm, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #92747 (Simplification of BigNum::bit_length)
 - #92767 (Use the new language identifier for Rust in the PDB debug format)
 - #92775 (Inline std::os::unix::ffi::OsStringExt methods)
 - #92863 (Remove `&mut` from `io::read_to_string` signature)
 - #92865 (Ignore static lifetimes for GATs outlives lint)
 - #92873 (Generate more precise generator names)
 - #92879 (Add Sync bound to allocator parameter in vec::IntoIter)
 - #92892 (Do not fail evaluation in const blocks)

Failed merges:

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

2 years agoRollup merge of #92892 - compiler-errors:const-param-env-for-const-block, r=fee1...
Matthias Krüger [Sat, 15 Jan 2022 10:28:28 +0000 (11:28 +0100)]
Rollup merge of #92892 - compiler-errors:const-param-env-for-const-block, r=fee1-dead

Do not fail evaluation in const blocks

Evaluate const blocks with a const param-env, so we properly check `~const` trait bounds.

Fixes #92713
(I will fix the poor diagnostics in #92713 and #92712 in a separate PR)

cc `@nbdd0121` who wrote the code this PR touches in #89561

2 years agoRollup merge of #92879 - compiler-errors:into_iter_unsound, r=dtolnay
Matthias Krüger [Sat, 15 Jan 2022 10:28:27 +0000 (11:28 +0100)]
Rollup merge of #92879 - compiler-errors:into_iter_unsound, r=dtolnay

Add Sync bound to allocator parameter in vec::IntoIter

The `A: Sync` bound was forgotten in https://github.com/rust-lang/rust/commit/8725e4c33749b23f260b2fc46e090c3792b6f97e#diff-b78c3ab6d37f4ede32195707528f8a76c49d4557cc9d3a7a09417b5157729b9fR3132

Similar `unsafe impl Sync` in that commit _do_ include the `A: Sync` bound (and around the alloc lib), so I think this was just an honest mistake.

Here's an example of the unsoundness:  https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=16cbfeff7c934ae72ab632c1476fdd8b

`@steffahn` found this, I'm just putting up the fix cause nobody else did :^)

Fixes #92633

2 years agoRollup merge of #92873 - eholk:async-symbol-names, r=tmandry
Matthias Krüger [Sat, 15 Jan 2022 10:28:26 +0000 (11:28 +0100)]
Rollup merge of #92873 - eholk:async-symbol-names, r=tmandry

Generate more precise generator names

Currently all generators are named with a `generator$N` suffix, regardless of where they come from. This means an `async fn` shows up as a generator in stack traces, which can be surprising to async programmers since they should not need to know that async functions are implementated using generators.

This change generators a different name depending on the generator kind, allowing us to tell whether the generator is the result of an async block, an async closure, an async fn, or a plain generator.

r? `@tmandry`
cc `@michaelwoerister` `@wesleywiser` `@dpaoliello`

2 years agoRollup merge of #92865 - jackh726:gats-outlives-no-static, r=nikomatsakis
Matthias Krüger [Sat, 15 Jan 2022 10:28:25 +0000 (11:28 +0100)]
Rollup merge of #92865 - jackh726:gats-outlives-no-static, r=nikomatsakis

Ignore static lifetimes for GATs outlives lint

cc https://github.com/rust-lang/rust/issues/87479#issuecomment-1010484170

Also included a bit of cleanup of `ty_known_to_outlive` and `region_known_to_outlive`

r? `@nikomatsakis`

2 years agoRollup merge of #92863 - camelid:read_to_string-rm-mut, r=m-ou-se
Matthias Krüger [Sat, 15 Jan 2022 10:28:24 +0000 (11:28 +0100)]
Rollup merge of #92863 - camelid:read_to_string-rm-mut, r=m-ou-se

Remove `&mut` from `io::read_to_string` signature

``@m-ou-se`` [realized][1] that because `Read` is implemented for `&mut impl
Read`, there's no need to take `&mut` in `io::read_to_string`.

Removing the `&mut` from the signature allows users to remove the `&mut`
from their calls (and thus pass an owned reader) if they don't use the
reader later.

r? `@m-ou-se`

[1]: https://github.com/rust-lang/rust/issues/80218#issuecomment-874322129

2 years agoRollup merge of #92775 - xfix:osstringext-inline, r=m-ou-se
Matthias Krüger [Sat, 15 Jan 2022 10:28:23 +0000 (11:28 +0100)]
Rollup merge of #92775 - xfix:osstringext-inline, r=m-ou-se

Inline std::os::unix::ffi::OsStringExt methods

Those methods essentially do nothing at assembly level. On Unix systems, `OsString` is represented as a `Vec` without performing any transformations.

2 years agoRollup merge of #92767 - arlosi:pdbenum, r=cuviper
Matthias Krüger [Sat, 15 Jan 2022 10:28:22 +0000 (11:28 +0100)]
Rollup merge of #92767 - arlosi:pdbenum, r=cuviper

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 agoRollup merge of #92747 - swenson:bignum-bit-length-optimization, r=scottmcm
Matthias Krüger [Sat, 15 Jan 2022 10:28:22 +0000 (11:28 +0100)]
Rollup merge of #92747 - swenson:bignum-bit-length-optimization, r=scottmcm

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 agoAuto merge of #92604 - nnethercote:optimize-impl_read_unsigned_leb128, r=michaelwoerister
bors [Sat, 15 Jan 2022 07:27:30 +0000 (07:27 +0000)]
Auto merge of #92604 - nnethercote:optimize-impl_read_unsigned_leb128, r=michaelwoerister

Optimize `impl_read_unsigned_leb128`

I see instruction count improvements of up to 3.5% locally with these changes, mostly on the smaller benchmarks.

r? `@michaelwoerister`

2 years agoAuto merge of #92915 - matthiaskrgr:rollup-pxxk8jp, r=matthiaskrgr
bors [Sat, 15 Jan 2022 04:24:13 +0000 (04:24 +0000)]
Auto merge of #92915 - matthiaskrgr:rollup-pxxk8jp, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #92191 (Prefer projection candidates instead of param_env candidates for Sized predicates)
 - #92382 (Extend const_convert to rest of blanket core::convert impls)
 - #92625 (Add `#[track_caller]` to `mirbug`)
 - #92684 (Export `tcp::IntoIncoming`)
 - #92743 (Use pre-interned symbols in a couple of places)
 - #92838 (Clean up some links in RELEASES)
 - #92868 (librustdoc: Address some clippy lints)
 - #92875 (Make `opt_const_param_of` work in the presence of `GenericArg::Infer`)
 - #92891 (Add myself to .mailmap)

Failed merges:

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

2 years agoRollup merge of #92891 - JamesHinshelwood:patch-1, r=Mark-Simulacrum
Matthias Krüger [Sat, 15 Jan 2022 01:25:21 +0000 (02:25 +0100)]
Rollup merge of #92891 - JamesHinshelwood:patch-1, r=Mark-Simulacrum

Add myself to .mailmap

(to de-duplicate my identities in the contributors list)

2 years agoRollup merge of #92875 - BoxyUwU:infer_arg_opt_const_param_of, r=lcnr
Matthias Krüger [Sat, 15 Jan 2022 01:25:20 +0000 (02:25 +0100)]
Rollup merge of #92875 - BoxyUwU:infer_arg_opt_const_param_of, r=lcnr

Make `opt_const_param_of` work in the presence of `GenericArg::Infer`

highly recommend viewing the first and second commits on their own rather than looking at file changes :rofl:

Because we filtered args down to just const args we would ignore `GenericArg::Infer` which made us get a `arg_index` which was wrong by however many const `GenericArg::Infer` came previously

[example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=46dba6a53aca6333028a10908ef16e0b) of the [bugs](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=a8eebced26eefa4119fc2e7ae0c76de6) fixed.

r? ```@lcnr```

2 years agoRollup merge of #92868 - pierwill:librustdoc-clippy, r=camelid
Matthias Krüger [Sat, 15 Jan 2022 01:25:19 +0000 (02:25 +0100)]
Rollup merge of #92868 - pierwill:librustdoc-clippy, r=camelid

librustdoc: Address some clippy lints

2 years agoRollup merge of #92838 - ehuss:cleanup-release-links, r=Mark-Simulacrum
Matthias Krüger [Sat, 15 Jan 2022 01:25:18 +0000 (02:25 +0100)]
Rollup merge of #92838 - ehuss:cleanup-release-links, r=Mark-Simulacrum

Clean up some links in RELEASES

This fixes some issues with markdown links in the RELEASES file.

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 #92912 - calebcartwright:rustfmt-generated-files, r=Mark-Simulacrum
bors [Sat, 15 Jan 2022 01:18:10 +0000 (01:18 +0000)]
Auto merge of #92912 - calebcartwright:rustfmt-generated-files, r=Mark-Simulacrum

resolve rustfmt issue with generated files

Discussed in https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/1.2E58.20patch.20release

refs https://github.com/rust-lang/rustfmt/issues/5080#issuecomment-1013303455 and https://github.com/rust-lang/rustfmt/issues/5172

updating in-tree vs. subtree sync to make backporting easier, would like to nominate backporting to both beta/1.59 as well as the 1.58.1 patch release

2 years agonyahggdshjjghsdfhgsf
Ellen [Thu, 13 Jan 2022 09:26:27 +0000 (09:26 +0000)]
nyahggdshjjghsdfhgsf

2 years agounrevert # 88557
Ellen [Wed, 12 Jan 2022 23:38:32 +0000 (23:38 +0000)]
unrevert # 88557

2 years agoattempt to re-add `ty::Unevaluated` visitor and friends
Ellen [Wed, 12 Jan 2022 23:29:10 +0000 (23:29 +0000)]
attempt to re-add `ty::Unevaluated` visitor and friends

2 years agoinitial revert
Ellen [Wed, 12 Jan 2022 03:19:52 +0000 (03:19 +0000)]
initial revert

2 years agofix(rustfmt): resolve generated file formatting issue
Caleb Cartwright [Sat, 15 Jan 2022 00:18:37 +0000 (18:18 -0600)]
fix(rustfmt): resolve generated file formatting issue

2 years agoDo not fail evaluation in const blocks
Michael Goulet [Fri, 14 Jan 2022 11:39:29 +0000 (03:39 -0800)]
Do not fail evaluation in const blocks

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 agoFix some links that had colliding reference names.
Eric Huss [Thu, 13 Jan 2022 02:07:53 +0000 (18:07 -0800)]
Fix some links that had colliding reference names.

These reference names were very general, and used in other places.

2 years agoFix link name collision for cargo#2365 (1.8cv)
Eric Huss [Thu, 13 Jan 2022 02:05:16 +0000 (18:05 -0800)]
Fix link name collision for cargo#2365 (1.8cv)

2 years agoFix incorrect link for #38622.
Eric Huss [Thu, 13 Jan 2022 02:04:39 +0000 (18:04 -0800)]
Fix incorrect link for #38622.

2 years agoRemove duplicate #39983. It was part of 1.19.
Eric Huss [Thu, 13 Jan 2022 02:04:07 +0000 (18:04 -0800)]
Remove duplicate #39983. It was part of 1.19.

2 years agoRemove duplicate cargo/4270. It was part of 1.21.
Eric Huss [Thu, 13 Jan 2022 02:03:22 +0000 (18:03 -0800)]
Remove duplicate cargo/4270. It was part of 1.21.

2 years agoRemove unused link references.
Eric Huss [Thu, 13 Jan 2022 02:02:05 +0000 (18:02 -0800)]
Remove unused link references.

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 agoreviews ish
Ellen [Fri, 14 Jan 2022 13:44:52 +0000 (13:44 +0000)]
reviews ish

2 years agoAdd myself to .mailmap
James Hinshelwood [Fri, 14 Jan 2022 10:13:50 +0000 (10:13 +0000)]
Add myself to .mailmap

(to de-duplicate my identities in the contributors list)

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 agoAdd Sync bound to allocator parameter in vec::IntoIter
Michael Goulet [Fri, 14 Jan 2022 04:55:21 +0000 (20:55 -0800)]
Add Sync bound to allocator parameter in vec::IntoIter

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 agoreduce indentaton
Ellen [Fri, 14 Jan 2022 00:18:11 +0000 (00:18 +0000)]
reduce indentaton

2 years agofix bug
Ellen [Fri, 14 Jan 2022 00:17:09 +0000 (00:17 +0000)]
fix bug

2 years agoFix non-MSVC test
Eric Holk [Thu, 13 Jan 2022 23:56:51 +0000 (15:56 -0800)]
Fix non-MSVC test

2 years agoGenerate more precise generator names
Eric Holk [Thu, 13 Jan 2022 23:31:36 +0000 (15:31 -0800)]
Generate more precise generator names

Currently all generators are named with a `generator$N` suffix,
regardless of where they come from. This means an `async fn` shows up as
a generator in stack traces, which can be surprising to async
programmers since they should not need to know that async functions are
implementated using generators.

This change generators a different name depending on the generator kind,
allowing us to tell whether the generator is the result of an async
block, an async closure, an async fn, or a plain generator.

2 years agolibrustdoc: Address some clippy lints
pierwill [Thu, 13 Jan 2022 22:26:31 +0000 (16:26 -0600)]
librustdoc: Address some clippy lints

Also ignore clippy's "collapsible if..." lints.

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 agoIgnore static lifetimes for GATs outlives lint
Jack Huey [Thu, 13 Jan 2022 20:07:12 +0000 (15:07 -0500)]
Ignore static lifetimes for GATs outlives lint

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 agoRemove `&mut` from `io::read_to_string` signature
Noah Lev [Thu, 13 Jan 2022 18:48:07 +0000 (10:48 -0800)]
Remove `&mut` from `io::read_to_string` signature

`@m-ou-se` [realized][1] that because `Read` is implemented for `&mut impl
Read`, there's no need to take `&mut` in `io::read_to_string`.

Removing the `&mut` from the signature allows users to remove the `&mut`
from their calls (and thus pass an owned reader) if they don't use the
reader later.

[1]: https://github.com/rust-lang/rust/issues/80218#issuecomment-874322129

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.