]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agorustdoc: remove hover gap in file picker
Roland Strasser [Fri, 7 Oct 2022 23:30:13 +0000 (01:30 +0200)]
rustdoc: remove hover gap in file picker

20 months agoAuto merge of #102787 - Dylan-DPC:rollup-fvbb4t9, r=Dylan-DPC
bors [Fri, 7 Oct 2022 17:37:39 +0000 (17:37 +0000)]
Auto merge of #102787 - Dylan-DPC:rollup-fvbb4t9, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #102300 (Use a macro to not have to copy-paste `ConstFnMutClosure::new(&mut fold, NeverShortCircuit::wrap_mut_2_imp)).0` everywhere)
 - #102475 (unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update)
 - #102760 (Avoid repeated re-initialization of the BufReader buffer)
 - #102764 (Check `WhereClauseReferencesSelf` after all other object safety checks)
 - #102779 (Fix `type_of` ICE)
 - #102780 (run Miri CI when std::sys changes)

Failed merges:

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

20 months agoRollup merge of #102780 - RalfJung:miri-lib-sys, r=Mark-Simulacrum
Dylan DPC [Fri, 7 Oct 2022 16:35:32 +0000 (22:05 +0530)]
Rollup merge of #102780 - RalfJung:miri-lib-sys, r=Mark-Simulacrum

run Miri CI when std::sys changes

r? `@Mark-Simulacrum`

20 months agoRollup merge of #102779 - TaKO8Ki:fix-type-of-ice-102768, r=fee1-dead
Dylan DPC [Fri, 7 Oct 2022 16:35:32 +0000 (22:05 +0530)]
Rollup merge of #102779 - TaKO8Ki:fix-type-of-ice-102768, r=fee1-dead

Fix `type_of` ICE

Fixes #102768

20 months agoRollup merge of #102764 - compiler-errors:issue-102762, r=jackh726
Dylan DPC [Fri, 7 Oct 2022 16:35:31 +0000 (22:05 +0530)]
Rollup merge of #102764 - compiler-errors:issue-102762, r=jackh726

Check `WhereClauseReferencesSelf` after all other object safety checks

This fixes the ICE because it causes us to detect another *non-lint* `MethodViolationCode` first, instead of breaking on `WhereClauseReferencesSelf`.

We could also approach this issue by instead returning a vector of *all* of the `MethodViolationCode`s, and just reporting the first one we see, but treating it as a hard error if we return both `WhereClauseReferencesSelf` and some other violation code -- let me know if this is desired.

Fixes #102762

20 months agoRollup merge of #102760 - saethlin:dont-reinit-buffer, r=Mark-Simulacrum
Dylan DPC [Fri, 7 Oct 2022 16:35:31 +0000 (22:05 +0530)]
Rollup merge of #102760 - saethlin:dont-reinit-buffer, r=Mark-Simulacrum

Avoid repeated re-initialization of the BufReader buffer

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

We accidentally removed this in https://github.com/rust-lang/rust/pull/98748. It looks so redundant. But it isn't.

The default `Read::read_buf` will defensively initialize the whole buffer, if any of it is indicated to be uninitialized. In uses where reads from the wrapped `Read` impl completely fill the `BufReader`, `initialized` and `filled` are the same, and this extra member isn't required. But in the reported issue, the `BufReader` wraps a `Read` impl which will _never_ fill the whole buffer. So the default `Read::read_buf` implementation repeatedly re-initializes the extra space in the buffer.

This adds back the extra `initialized` member, which ensures that the default `Read::read_buf` only zero-initialized the buffer once, and I've tried to add a comment which explains this whole situation.

20 months agoRollup merge of #102475 - RalfJung:unsafe, r=dtolnay
Dylan DPC [Fri, 7 Oct 2022 16:35:30 +0000 (22:05 +0530)]
Rollup merge of #102475 - RalfJung:unsafe, r=dtolnay

unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update

Having a safe `fn` in an `unsafe trait` vs an `unsafe fn` in a safe `trait` are pretty different situations, but the distinction is subtle and can confuse even seasoned Rust developers. So let's have explicit examples of both. I also removed the existing `unsafe trait` example since it was rather strange.

Also the `unsafe_op_in_unsafe_fn` lint can help disentangle the two sides of `unsafe`, so update the docs to account for that.

20 months agoRollup merge of #102300 - scottmcm:simpler-fold-closures, r=Mark-Simulacrum
Dylan DPC [Fri, 7 Oct 2022 16:35:29 +0000 (22:05 +0530)]
Rollup merge of #102300 - scottmcm:simpler-fold-closures, r=Mark-Simulacrum

Use a macro to not have to copy-paste `ConstFnMutClosure::new(&mut fold, NeverShortCircuit::wrap_mut_2_imp)).0` everywhere

Also use that macro to replace a bunch of places that had custom closure-wrappers.

+35 -114 sounds good to me.

20 months agoAuto merge of #101632 - camsteffen:refactor-infer-err, r=lcnr
bors [Fri, 7 Oct 2022 13:54:55 +0000 (13:54 +0000)]
Auto merge of #101632 - camsteffen:refactor-infer-err, r=lcnr

Remove `TypeckResults` from `InferCtxt`

`InferCtxt` currently has `in_progress_typeck_results` which is only used for some diagnostics during typeck. It adds a lifetime which propagates through a lot of code. This PR moves that field into a new helper struct `TypeErrCtxt`.

20 months agoreview feedback
Ralf Jung [Fri, 7 Oct 2022 13:21:47 +0000 (15:21 +0200)]
review feedback

20 months agorun Miri CI when std::sys changes
Ralf Jung [Fri, 7 Oct 2022 12:39:07 +0000 (14:39 +0200)]
run Miri CI when std::sys changes

20 months agoChange InferCtxtBuilder from enter to build
Cameron Steffen [Tue, 20 Sep 2022 03:03:59 +0000 (22:03 -0500)]
Change InferCtxtBuilder from enter to build

20 months agofix a ICE #102768
Takayuki Maeda [Fri, 7 Oct 2022 12:10:08 +0000 (21:10 +0900)]
fix a ICE #102768

20 months agoRemove a reference from Inherited
Cameron Steffen [Fri, 9 Sep 2022 20:25:29 +0000 (15:25 -0500)]
Remove a reference from Inherited

20 months agoRemove TypeckResults from InferCtxt
Cameron Steffen [Fri, 9 Sep 2022 18:01:06 +0000 (13:01 -0500)]
Remove TypeckResults from InferCtxt

20 months agoIntroduce TypeErrCtxt
Cameron Steffen [Fri, 9 Sep 2022 20:08:06 +0000 (15:08 -0500)]
Introduce TypeErrCtxt

TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't
need to.

20 months agoAuto merge of #102025 - chenyukang:fix-102002, r=jyn514
bors [Fri, 7 Oct 2022 10:46:04 +0000 (10:46 +0000)]
Auto merge of #102025 - chenyukang:fix-102002, r=jyn514

Delete the stage1 and stage0-sysroot directories when using download-rustc

Fixes #102002

20 months agoAuto merge of #102767 - matthiaskrgr:rollup-vcbt81v, r=matthiaskrgr
bors [Fri, 7 Oct 2022 07:31:53 +0000 (07:31 +0000)]
Auto merge of #102767 - matthiaskrgr:rollup-vcbt81v, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #102577 (Warn about Visual Studio Code branding confusion)
 - #102720 (do not reverse the expected type and found type for ObligationCauseCo…)
 - #102744 (rustdoc: remove unused CSS `.content .item-list`)
 - #102747 (rustdoc: remove unused CSS `.docblock a:not(.srclink)`)
 - #102748 (Disable compressed debug sections on i586-gnu)
 - #102761 (let-else: test else block with non-never uninhabited type)

Failed merges:

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

20 months agoRollup merge of #102761 - est31:let_else_uninhabited_test, r=compiler-errors
Matthias Krüger [Fri, 7 Oct 2022 05:28:12 +0000 (07:28 +0200)]
Rollup merge of #102761 - est31:let_else_uninhabited_test, r=compiler-errors

let-else: test else block with non-never uninhabited type

let else currently does not allow uninhabited types for the `else` block that aren't `!`. One can maybe think about relaxing this in the future, but if it is done, it should be an explicit choice and not an unexpected side effect of e.g. a refactor. Thus, I'm extending a test that will fail if the behaviour changes.

20 months agoRollup merge of #102748 - cuviper:i586-gnu-uncompress, r=pietroalbini
Matthias Krüger [Fri, 7 Oct 2022 05:28:11 +0000 (07:28 +0200)]
Rollup merge of #102748 - cuviper:i586-gnu-uncompress, r=pietroalbini

Disable compressed debug sections on i586-gnu

Compressed debug is enabled by default for gas (assembly) on Linux/x86
targets, and we started building our own in #102530, but that made our
`compiler_builtins` incompatible with binutils < 2.32. Add an explicit
option to disable that in our crosstool-ng config. Fixes #102703.

20 months agoRollup merge of #102747 - notriddle:notriddle/docblock-a-not-srclink, r=GuillaumeGomez
Matthias Krüger [Fri, 7 Oct 2022 05:28:11 +0000 (07:28 +0200)]
Rollup merge of #102747 - notriddle:notriddle/docblock-a-not-srclink, r=GuillaumeGomez

rustdoc: remove unused CSS `.docblock a:not(.srclink)`

This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480, because the list of impl items could be nested below `docblock`.

https://github.com/rust-lang/rust/blob/c7312fbae4979c6d4fdfbd1f55a71cd47d82a480/src/librustdoc/html/render.rs#L3841-L3845

Now that rustdoc toggles have been switched to `<details>`, there shouldn't be any need to put things inside docblock containers just to give them disclosure toggles.

20 months agoRollup merge of #102744 - notriddle:notriddle/content-item-list, r=GuillaumeGomez
Matthias Krüger [Fri, 7 Oct 2022 05:28:10 +0000 (07:28 +0200)]
Rollup merge of #102744 - notriddle:notriddle/content-item-list, r=GuillaumeGomez

rustdoc: remove unused CSS `.content .item-list`

When these rules were added in 4fd061c426902b0904c65e64a3780b21f9ab3afb (yeah, that's the very first commit of rustdoc_ng), `.item-list` was a `<ul>`, and this would override the default style for that tag.

In c1b1d6804bfce1aee3a95b3cbff3eaeb15bad9a4, it was changed to use a `<div>` tag, so these rules are both no-ops.

20 months agoRollup merge of #102720 - lyming2007:issue-102397-fix, r=compiler-errors
Matthias Krüger [Fri, 7 Oct 2022 05:28:10 +0000 (07:28 +0200)]
Rollup merge of #102720 - lyming2007:issue-102397-fix, r=compiler-errors

do not reverse the expected type and found type for ObligationCauseCo…

…de of IfExpressionWithNoElse

this will fix #102397

20 months agoRollup merge of #102577 - kornelski:non-code-visual-studio, r=wesleywiser
Matthias Krüger [Fri, 7 Oct 2022 05:28:09 +0000 (07:28 +0200)]
Rollup merge of #102577 - kornelski:non-code-visual-studio, r=wesleywiser

Warn about Visual Studio Code branding confusion

VS Code is a popular companion for Rust, but Microsoft's branding is confusing, and users [may not understand](https://users.rust-lang.org/t/complie-error-when-i-run-rustc/82127) they also need the *other* VS.

20 months agoAuto merge of #101988 - petrochenkov:flavor2, r=lqd
bors [Fri, 7 Oct 2022 03:35:02 +0000 (03:35 +0000)]
Auto merge of #101988 - petrochenkov:flavor2, r=lqd

rustc_target: Refactor internal linker flavors

In accordance with the design from https://github.com/rust-lang/rust/pull/96827#issuecomment-1208441595

`lld_flavor` and `linker_is_gnu` fields are removed from internal target specs, but still parsed from JSON specs using compatibility layer introduced in https://github.com/rust-lang/rust/pull/100552.
r? `@lqd`

20 months agoAvoid defensive re-initialization of the BufReader buffer
Ben Kimock [Fri, 7 Oct 2022 00:09:54 +0000 (20:09 -0400)]
Avoid defensive re-initialization of the BufReader buffer

20 months agoCheck WhereClauseReferencesSelf after all other object safety checks
Michael Goulet [Fri, 7 Oct 2022 02:29:19 +0000 (02:29 +0000)]
Check WhereClauseReferencesSelf after all other object safety checks

20 months agolet-else: test else block with non-never uninhabited type
est31 [Fri, 7 Oct 2022 00:42:02 +0000 (02:42 +0200)]
let-else: test else block with non-never uninhabited type

20 months agoAuto merge of #102729 - flip1995:clippyup, r=Manishearth
bors [Thu, 6 Oct 2022 23:11:18 +0000 (23:11 +0000)]
Auto merge of #102729 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

20 months agoWarn about Visual Studio Code branding confusion
Kornel [Sun, 2 Oct 2022 12:18:54 +0000 (13:18 +0100)]
Warn about Visual Studio Code branding confusion

20 months agoAuto merge of #102741 - matthiaskrgr:rollup-63no5tz, r=matthiaskrgr
bors [Thu, 6 Oct 2022 19:55:48 +0000 (19:55 +0000)]
Auto merge of #102741 - matthiaskrgr:rollup-63no5tz, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #98496 (make `compare_const_impl` a query and use it in `instance.rs`)
 - #102680 (Fix overconstrained Send impls in btree internals)
 - #102718 (Fix `opaque_hidden_inferred_bound` lint ICE)
 - #102725 (Remove `-Ztime`)
 - #102736 (Migrate search input color to CSS variable)

Failed merges:

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

20 months agoDisable compressed debug sections on i586-gnu
Josh Stone [Thu, 6 Oct 2022 19:13:23 +0000 (12:13 -0700)]
Disable compressed debug sections on i586-gnu

Compressed debug is enabled by default for gas (assembly) on Linux/x86
targets, and we started building our own in #102530, but that made our
`compiler_builtins` incompatible with binutils < 2.32. Add an explicit
option to disable that in our crosstool-ng config. Fixes #102703.

20 months agorustdoc: remove unused CSS `.docblock a:not(.srclink)`
Michael Howell [Thu, 6 Oct 2022 18:20:37 +0000 (11:20 -0700)]
rustdoc: remove unused CSS `.docblock a:not(.srclink)`

This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480,
because the list of impl items could be nested below `docblock`.

https://github.com/rust-lang/rust/blob/c7312fbae4979c6d4fdfbd1f55a71cd47d82a480/src/librustdoc/html/render.rs#L3841-L3845

Now that rustdoc toggles have been switched to `<details>`, there shouldn't
be any need to put things inside docblock containers just to give them
disclosure toggles.

20 months agorustdoc: remove unused HTML `class="item-list"`
Michael Howell [Thu, 6 Oct 2022 17:20:47 +0000 (10:20 -0700)]
rustdoc: remove unused HTML `class="item-list"`

Since 50f662e99ec372a3c9558876d4164e8665859217, there is no CSS or JS
targeting this class.

20 months agorustdoc: remove unused CSS `.content .item-list`
Michael Howell [Thu, 6 Oct 2022 17:18:16 +0000 (10:18 -0700)]
rustdoc: remove unused CSS `.content .item-list`

When these rules were added in 4fd061c426902b0904c65e64a3780b21f9ab3afb
(yeah, that's the very first commit of rustdoc_ng), `.item-list` was a
`<ul>`, and this would override the default style for that tag.

In c1b1d6804bfce1aee3a95b3cbff3eaeb15bad9a4, it was changed to use a
`<div>` tag, so these rules are both no-ops.

20 months agoMerge commit '8f1ebdd18bdecc621f16baaf779898cc08cc2766' into clippyup
Philipp Krones [Thu, 6 Oct 2022 15:41:53 +0000 (17:41 +0200)]
Merge commit '8f1ebdd18bdecc621f16baaf779898cc08cc2766' into clippyup

20 months agoAuto merge of #9593 - Andy-Python-Programmer:master, r=llogiq
bors [Thu, 6 Oct 2022 14:39:26 +0000 (14:39 +0000)]
Auto merge of #9593 - Andy-Python-Programmer:master, r=llogiq

lint::unsafe_removed_from_name: fix false positive result when allowed

changelog: [`unsafe_removed_from_name`] Fix allowing on imports produces a false positive on `useless_attribute`.

Fixes: #9197
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
20 months agoRollup merge of #102736 - GuillaumeGomez:search-input-color, r=notriddle
Matthias Krüger [Thu, 6 Oct 2022 14:29:45 +0000 (16:29 +0200)]
Rollup merge of #102736 - GuillaumeGomez:search-input-color, r=notriddle

Migrate search input color to CSS variable

Part of https://github.com/rust-lang/rust/pull/98460.

No UI changes.

r? `@notriddle`

20 months agoRollup merge of #102725 - nnethercote:rm-Z-time, r=davidtwco
Matthias Krüger [Thu, 6 Oct 2022 14:29:45 +0000 (16:29 +0200)]
Rollup merge of #102725 - nnethercote:rm-Z-time, r=davidtwco

Remove `-Ztime`

Because it has a lot of overlap with `-Ztime-passes` but is generally less useful. Plus some related cleanups.

Best reviewed one commit at a time.

r? `@davidtwco`

20 months agoRollup merge of #102718 - compiler-errors:opaque-bound-lint-ice, r=fee1-dead
Matthias Krüger [Thu, 6 Oct 2022 14:29:44 +0000 (16:29 +0200)]
Rollup merge of #102718 - compiler-errors:opaque-bound-lint-ice, r=fee1-dead

Fix `opaque_hidden_inferred_bound` lint ICE

Fixes #102705

20 months agoRollup merge of #102680 - dtolnay:btreesend, r=thomcc
Matthias Krüger [Thu, 6 Oct 2022 14:29:44 +0000 (16:29 +0200)]
Rollup merge of #102680 - dtolnay:btreesend, r=thomcc

Fix overconstrained Send impls in btree internals

Fixes https://github.com/dtolnay/async-trait/issues/215.

Minimal repro:

```rust
use std::collections::btree_map::Iter;

fn require_send<T: Send>(_: T) {}

fn main() {
    require_send(async {
        let _iter = None::<Iter<(), &()>>;
        async {}.await;
    });
}
```

```console
error: higher-ranked lifetime error
 --> src/main.rs:6:5
  |
6 | /     require_send(async {
7 | |         let _iter = None::<Iter<(), &()>>;
8 | |         async {}.await;
9 | |     });
  | |______^
  |
  = note: could not prove `impl Future<Output = ()>: Send`
```

Not-quite-so-minimal repro:

```rust
use std::collections::BTreeMap;
use std::future::Future;

fn spawn<T: Future + Send>(_: T) {}

async fn f() {
    let map = BTreeMap::<u32, Box<dyn Send + Sync>>::new();
    for _ in &map {
        async {}.await;
    }
}

fn main() {
    spawn(f());
}
```

```console
error: higher-ranked lifetime error
  --> src/main.rs:14:5
   |
14 |     spawn(f());
   |     ^^^^^^^^^^
   |
   = note: could not prove `impl Future<Output = ()>: Send`
```

I am not familiar with the btree internals, but it seems clear to me that the `async fn f` above should return a Send future. Using HashMap instead of BTreeMap in that code makes it already return a Send future.

The _"higher-ranked lifetime error"_ message may be a regression in Rust 1.63. Using older compilers the error message was more detailed:

```console
error: implementation of `Send` is not general enough
  --> src/main.rs:14:5
   |
14 |     spawn(f());
   |     ^^^^^ implementation of `Send` is not general enough
   |
   = note: `Send` would have to be implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'0>, u32, Box<(dyn Send + Sync + '1)>, alloc::collections::btree::node::marker::LeafOrInternal>`, for any two lifetimes `'0` and `'1`...
   = note: ...but `Send` is actually implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'2>, u32, Box<dyn Send + Sync>, alloc::collections::btree::node::marker::LeafOrInternal>`, for some specific lifetime `'2`

error: implementation of `Send` is not general enough
  --> src/main.rs:14:5
   |
14 |     spawn(f());
   |     ^^^^^ implementation of `Send` is not general enough
   |
   = note: `Send` would have to be implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'0>, u32, Box<(dyn Send + Sync + '1)>, alloc::collections::btree::node::marker::Leaf>`, for any two lifetimes `'0` and `'1`...
   = note: ...but `Send` is actually implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'2>, u32, Box<dyn Send + Sync>, alloc::collections::btree::node::marker::Leaf>`, for some specific lifetime `'2`
```

20 months agoRollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnr
Matthias Krüger [Thu, 6 Oct 2022 14:29:43 +0000 (16:29 +0200)]
Rollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnr

make `compare_const_impl` a query and use it in `instance.rs`

Fixes #88365

the bug in #88365 was caused by some `instance.rs` code using the `PartialEq` impl on `Ty` to check that the type of the associated const in an impl is the same as the type of the associated const in the trait definition. This was wrong for two reasons:
- the check typeck does is that the impl type is a subtype of the trait definition's type (see `mismatched_impl_ty_2.rs` which [was ICEing](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f6d60ebe6745011f0d52ab2bc712025d) before this PR on stable)
- it assumes that if two types are equal then the `PartialEq` impl will reflect that which isnt true for higher ranked types or type level constants when `feature(generic_const_exprs)` is enabled (see `mismatched_impl_ty_3.rs` for higher ranked types which was [ICEing on stable](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d7af131a655ed515b035624626c62c71))

r? `@lcnr`

20 months agoAuto merge of #9599 - nyurik:inline-crash, r=flip1995
bors [Thu, 6 Oct 2022 14:12:29 +0000 (14:12 +0000)]
Auto merge of #9599 - nyurik:inline-crash, r=flip1995

Add a temporary workaround for  multiline formart arg inlining

per suggestion in
https://github.com/rust-lang/rust/pull/102729#discussion_r988990080

workaround for an internal crash when handling multi-line format argument inlining.

changelog: none

(no point for changelog because it is still a new lint being introduced)

20 months agoAdd a temporary workaround for multiline formart arg inlining
Yuri Astrakhan [Thu, 6 Oct 2022 13:12:37 +0000 (09:12 -0400)]
Add a temporary workaround for  multiline formart arg inlining

per suggestion in
https://github.com/rust-lang/rust/pull/102729#discussion_r988990080

workaround for an internal crash when handling multi-line format
argument inlining.

20 months agoAuto merge of #9598 - nyurik:fix-comment, r=Alexendoo
bors [Thu, 6 Oct 2022 12:56:27 +0000 (12:56 +0000)]
Auto merge of #9598 - nyurik:fix-comment, r=Alexendoo

lint: fix a few comments

minor cleanup per `@Alexendoo` [comment](https://github.com/rust-lang/rust-clippy/pull/9586#discussion_r988991976)

changelog: none

20 months agolint: fix a few comments
Yuri Astrakhan [Thu, 6 Oct 2022 12:54:07 +0000 (08:54 -0400)]
lint: fix a few comments

20 months agoAuto merge of #99497 - vladimir-ea:stdlib_os_api_watchos, r=thomcc
bors [Thu, 6 Oct 2022 12:14:21 +0000 (12:14 +0000)]
Auto merge of #99497 - vladimir-ea:stdlib_os_api_watchos, r=thomcc

Standard library OS support for Apple WatchOS

This PR was split from https://github.com/rust-lang/rust/pull/98101

20 months agoMigrate search input color to CSS variable
Guillaume Gomez [Thu, 6 Oct 2022 11:01:07 +0000 (13:01 +0200)]
Migrate search input color to CSS variable

20 months agorustc_target: Refactor internal linker flavors
Vadim Petrochenkov [Sat, 6 Aug 2022 18:08:46 +0000 (21:08 +0300)]
rustc_target: Refactor internal linker flavors

In accordance with the design from https://github.com/rust-lang/rust/pull/96827#issuecomment-1208441595

20 months agoAuto merge of #102707 - fmease:rustdoc-render-more-cross-crate-hrtbs-properly, r...
bors [Thu, 6 Oct 2022 08:58:01 +0000 (08:58 +0000)]
Auto merge of #102707 - fmease:rustdoc-render-more-cross-crate-hrtbs-properly, r=GuillaumeGomez

rustdoc: render more cross-crate HRTBs properly

Follow-up to #102439.
Render the `for<>` parameter lists of cross-crate higher-rank trait bounds (in where-clauses and in `impl Trait`).

I've added a new field `bound_params` to `clean::WherePredicate::EqPredicate` (mirroring its sibling variant `BoundPredicate`). However, I had to box the existing fields since `EqPredicate` used to be the largest variant (128 bytes on 64-bit systems) and it would only have gotten bigger).
Not sure if you like that approach. As an alternative, I could pass the uncleaned `ty::Predicate` alongside the cleaned `WherePredicate` to the various re-sugaring methods (similar to what `clean::AutoTraitFinder::param_env_to_generics` does).

I haven't yet added the HTML & JSON rendering code for the newly added `bound_params` field since I am waiting for your opinion. Those two rendering code paths should actually be unreachable in practice given we re-sugar all(?) equality predicates to associated type bindings (and arbitrary equality predicates are not part of the Rust surface language at the time of this writing).

If you agree with storing `bound_params` in `EqPredicate`, I think I can use it to greatly simplify the `clean::auto_trait` module (by also using `simplify::merge_bounds`). Maybe I can do that in any case though.

`@rustbot` label T-rustdoc A-cross-crate-reexports
r? `@GuillaumeGomez`

20 months agoUpdate Cargo.lock
Philipp Krones [Thu, 6 Oct 2022 07:45:08 +0000 (09:45 +0200)]
Update Cargo.lock

20 months agoMerge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup
Philipp Krones [Thu, 6 Oct 2022 07:44:38 +0000 (09:44 +0200)]
Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup

20 months agoAuto merge of #9596 - flip1995:rustup, r=flip1995
bors [Thu, 6 Oct 2022 07:23:08 +0000 (07:23 +0000)]
Auto merge of #9596 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

20 months agoBump nightly version -> 2022-10-06
Philipp Krones [Thu, 6 Oct 2022 07:19:51 +0000 (09:19 +0200)]
Bump nightly version -> 2022-10-06

20 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 6 Oct 2022 07:19:29 +0000 (09:19 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

20 months agoreviews
Boxy [Thu, 6 Oct 2022 06:00:38 +0000 (07:00 +0100)]
reviews

20 months agoAuto merge of #102726 - matthiaskrgr:rollup-2ghn38b, r=matthiaskrgr
bors [Thu, 6 Oct 2022 05:58:27 +0000 (05:58 +0000)]
Auto merge of #102726 - matthiaskrgr:rollup-2ghn38b, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #102672 (rustdoc: remove unused CSS class `in-band`)
 - #102693 (Revert "Use getentropy when possible on all Apple platforms")
 - #102694 (Suggest calling method if fn does not exist)
 - #102708 (Suggest `==` to wrong assign expr)
 - #102710 (Add test for issue 82633)

Failed merges:

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

20 months agoRollup merge of #102710 - Rageking8:add-test-for-issue-82633, r=estebank
Matthias Krüger [Thu, 6 Oct 2022 05:07:37 +0000 (07:07 +0200)]
Rollup merge of #102710 - Rageking8:add-test-for-issue-82633, r=estebank

Add test for issue 82633

Fixes #82633

r? `@estebank`

The current stderr looks slightly different from [source](https://github.com/rust-lang/rust/pull/83915/files#diff-8c64c576ccaceb816e71d2279a6ee4bf79211bc06f55c46dda3f98a18748ad7a), so I used the latest one from nightly. Do let me know if anything is wrong.

20 months agoRollup merge of #102708 - TaKO8Ki:improve-eqeq-suggestion, r=estebank
Matthias Krüger [Thu, 6 Oct 2022 05:07:37 +0000 (07:07 +0200)]
Rollup merge of #102708 - TaKO8Ki:improve-eqeq-suggestion, r=estebank

Suggest `==` to wrong assign expr

Given the following code:

```rust
fn main() {
    let x = 3;
    let y = 3;
    if x == x && y = y {
        println!("{}", x);
    }
}
```

Current output is:

```
error[E0308]: mismatched types
 --> src/main.rs:4:18
  |
4 |     if x == x && y = y {
  |                  ^ expected `bool`, found integer

error[E0308]: mismatched types
 --> src/main.rs:4:8
  |
4 |     if x == x && y = y {
  |        ^^^^^^^^^^^^^^^ expected `bool`, found `()`
```

This adds a suggestion:

```diff
error[E0308]: mismatched types
 --> src/main.rs:6:18
  |
6 |     if x == x && y = y {
  |                  ^ expected `bool`, found integer

error[E0308]: mismatched types
 --> src/main.rs:6:8
  |
6 |     if x == x && y = y {
  |        ^^^^^^^^^^^^^^^ expected `bool`, found `()`
  |
+ help: you might have meant to compare for equality
+   |
+ 6 |     if x == x && y == y {
+   |                     +
```

And this fixes a part of #97469

20 months agoRollup merge of #102694 - compiler-errors:fn-to-method, r=davidtwco
Matthias Krüger [Thu, 6 Oct 2022 05:07:36 +0000 (07:07 +0200)]
Rollup merge of #102694 - compiler-errors:fn-to-method, r=davidtwco

Suggest calling method if fn does not exist

I tried to split this up into two commits, the first where we stash the resolution error until typeck (which causes a bunch of diagnostics changes because the ordering of error messages change), then the second commit is the actual logic that actually implements the suggestion.

I am not in love with the presentation of the suggestion, so I could use some advice for how to format the actual messaging.

r? diagnostics

Fixes #102518

20 months agoRollup merge of #102693 - BlackHoleFox:revert-apple-entropy-changes, r=thomcc
Matthias Krüger [Thu, 6 Oct 2022 05:07:36 +0000 (07:07 +0200)]
Rollup merge of #102693 - BlackHoleFox:revert-apple-entropy-changes, r=thomcc

Revert "Use getentropy when possible on all Apple platforms"

Per https://github.com/rust-lang/rust/issues/102643, This reverts commit 3fc35b5b935e390c61ea2bbf744838b2632b2df1 to avoid breaking any Rust on iOS users.

Closes https://github.com/rust-lang/rust/issues/102643

20 months agoRollup merge of #102672 - notriddle:notriddle/fqn-in-band, r=GuillaumeGomez
Matthias Krüger [Thu, 6 Oct 2022 05:07:35 +0000 (07:07 +0200)]
Rollup merge of #102672 - notriddle:notriddle/fqn-in-band, r=GuillaumeGomez

rustdoc: remove unused CSS class `in-band`

Since a7c25b29575c17434406b69773f8c2961af343b3 removed `in-band` from code headers, the only remaining uses of the `in-band` class are:

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/write_shared.rs#L520-L521

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/templates/print_item.html#L2-L3

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/context.rs#L637-L638

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L368-L369

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L401-L402

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/static/js/main.js#L525

Since all of these uses are nested below `h1.fqn`, we can get rid of it, and the support code that was used for when `in-band` was part of item rendering.

20 months agoBe consistent about deciding whether to print pass data.
Nicholas Nethercote [Thu, 6 Oct 2022 04:39:27 +0000 (15:39 +1100)]
Be consistent about deciding whether to print pass data.

`print_time_passes_entry` unconditionally prints data about a pass. The
most commonly used call site, in `VerboseTimingGuard::drop`, guards it
with a `should_print_passes` test. But there are a couple of other call
sites that don't do that test.

This commit moves the `should_print_passes` test within
`print_time_passes_entry` so that all passes are treated equally.

20 months agoRemove `-Ztime` option.
Nicholas Nethercote [Thu, 6 Oct 2022 03:51:45 +0000 (14:51 +1100)]
Remove `-Ztime` option.

The compiler currently has `-Ztime` and `-Ztime-passes`. I've used
`-Ztime-passes` for years but only recently learned about `-Ztime`.

What's the difference? Let's look at the `-Zhelp` output:
```
  -Z        time=val -- measure time of rustc processes (default: no)
  -Z time-passes=val -- measure time of each rustc pass (default: no)
```
The `-Ztime-passes` description is clear, but the `-Ztime` one is less so.
Sounds like it measures the time for the entire process?

No. The real difference is that `-Ztime-passes` prints out info about passes,
and `-Ztime` does the same, but only for a subset of those passes. More
specifically, there is a distinction in the profiling code between a "verbose
generic activity" and an "extra verbose generic activity". `-Ztime-passes`
prints both kinds, while `-Ztime` only prints the first one. (It took me
a close reading of the source code to determine this difference.)

In practice this distinction has low value. Perhaps in the past the "extra
verbose" output was more voluminous, but now that we only print stats for a
pass if it exceeds 5ms or alters the RSS, `-Ztime-passes` is less spammy. Also,
a lot of the "extra verbose" cases are for individual lint passes, and you need
to also use `-Zno-interleave-lints` to see those anyway.

Therefore, this commit removes `-Ztime` and the associated machinery. One thing
to note is that the existing "extra verbose" activities all have an extra
string argument, so the commit adds the ability to accept an extra argument to
the "verbose" activities.

20 months agoFix some comments.
Nicholas Nethercote [Thu, 6 Oct 2022 03:13:12 +0000 (14:13 +1100)]
Fix some comments.

- It's `--print`, not `--prints`.
- `-Ztime` and `-Ztime-passes` print to stderr, not stdout.

20 months agoAuto merge of #99324 - reez12g:issue-99144, r=jyn514
bors [Thu, 6 Oct 2022 03:01:57 +0000 (03:01 +0000)]
Auto merge of #99324 - reez12g:issue-99144, r=jyn514

Enable doctests in compiler/ crates

Helps with https://github.com/rust-lang/rust/issues/99144

20 months agoAuto merge of #102573 - RalfJung:mirisync, r=oli-obk
bors [Thu, 6 Oct 2022 00:00:29 +0000 (00:00 +0000)]
Auto merge of #102573 - RalfJung:mirisync, r=oli-obk

Miri sync

This is a Miri sync created with my experimental fork of josh. We should probably not merge this yet, but we can use this to check if the sync looks the way it should.

r? `@oli-obk`

20 months agorustdoc: remove unused CSS class `in-band`
Michael Howell [Tue, 4 Oct 2022 18:54:40 +0000 (11:54 -0700)]
rustdoc: remove unused CSS class `in-band`

Since a7c25b29575c17434406b69773f8c2961af343b3 removed `in-band` from code
headers, the only remaining uses of the `in-band` class are:

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/write_shared.rs#L520-L521

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/templates/print_item.html#L2-L3

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/context.rs#L637-L638

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L368-L369

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L401-L402

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/static/js/main.js#L525

Since all of these uses are nested below `h1.fqn`, we can get rid of it,
and the support code that was used for when `in-band` was part of item
rendering.

20 months agorustdoc: render more cross-crate hrtbs properly
León Orell Valerian Liehr [Tue, 4 Oct 2022 12:08:25 +0000 (14:08 +0200)]
rustdoc: render more cross-crate hrtbs properly

20 months agodo not reverse the expected type and found type for ObligationCauseCode of IfExpressi...
Yiming Lei [Wed, 5 Oct 2022 21:00:51 +0000 (14:00 -0700)]
do not reverse the expected type and found type for ObligationCauseCode of IfExpressionWithNoElse
this will fix #102397

20 months agoAuto merge of #102394 - dingxiangfei2009:issue-102317, r=oli-obk
bors [Wed, 5 Oct 2022 20:47:39 +0000 (20:47 +0000)]
Auto merge of #102394 - dingxiangfei2009:issue-102317, r=oli-obk

Fix unwind drop glue for if-then scopes

cc `@est31`

Fix #102317
Fix #99852

This PR fixes the drop glue for unwinding from a panic originated in a drop while breaking out for the else block in an `if-then` scope.
MIR validation does not fail for the synchronous versions of the test program, because `StorageDead` statements are skipped over in the unwinding process. It is only becoming a problem when it is inside a generator where `StorageDead` must be kept around.

20 months agoUse proper subdiagnostic
Michael Goulet [Wed, 5 Oct 2022 19:55:19 +0000 (19:55 +0000)]
Use proper subdiagnostic

20 months agoFix opaque_hidden_inferred_bound lint ICE
Michael Goulet [Wed, 5 Oct 2022 19:46:40 +0000 (19:46 +0000)]
Fix opaque_hidden_inferred_bound lint ICE

20 months agoFix overconstrained Send impls in btree internals
David Tolnay [Wed, 5 Oct 2022 18:46:12 +0000 (11:46 -0700)]
Fix overconstrained Send impls in btree internals

20 months agoAdd regression test for lifetimes in alloc internals autotraits
David Tolnay [Wed, 5 Oct 2022 18:23:14 +0000 (11:23 -0700)]
Add regression test for lifetimes in alloc internals autotraits

Currently pretty much all of the btree_map and btree_set ones fail, as
well as linked_list::DrainFilter.

    error: higher-ranked lifetime error
      --> library/alloc/tests/autotraits.rs:38:5
       |
    38 | /     require_send_sync(async {
    39 | |         let _v = None::<alloc::collections::btree_map::Iter<'_, &u32, &u32>>;
    40 | |         async {}.await;
    41 | |     });
       | |______^
       |
       = note: could not prove `impl Future<Output = ()>: Send`

    error: implementation of `Send` is not general enough
      --> library/alloc/tests/autotraits.rs:56:5
       |
    56 | /     require_send_sync(async {
    57 | |         let _v = None::<
    58 | |             alloc::collections::btree_map::DrainFilter<
    59 | |                 '_,
    ...  |
    65 | |         async {}.await;
    66 | |     });
       | |______^ implementation of `Send` is not general enough
       |
       = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
       = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: implementation of `Send` is not general enough
      --> library/alloc/tests/autotraits.rs:68:5
       |
    68 | /     require_send_sync(async {
    69 | |         let _v = None::<alloc::collections::btree_map::Entry<'_, &u32, &u32>>;
    70 | |         async {}.await;
    71 | |     });
       | |______^ implementation of `Send` is not general enough
       |
       = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
       = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: higher-ranked lifetime error
      --> library/alloc/tests/autotraits.rs:88:5
       |
    88 | /     require_send_sync(async {
    89 | |         let _v = None::<alloc::collections::btree_map::Iter<'_, &u32, &u32>>;
    90 | |         async {}.await;
    91 | |     });
       | |______^
       |
       = note: could not prove `impl Future<Output = ()>: Send`

    error: implementation of `Send` is not general enough
      --> library/alloc/tests/autotraits.rs:93:5
       |
    93 | /     require_send_sync(async {
    94 | |         let _v = None::<alloc::collections::btree_map::IterMut<'_, &u32, &u32>>;
    95 | |         async {}.await;
    96 | |     });
       | |______^ implementation of `Send` is not general enough
       |
       = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
       = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:98:5
        |
    98  | /     require_send_sync(async {
    99  | |         let _v = None::<alloc::collections::btree_map::Keys<'_, &u32, &u32>>;
    100 | |         async {}.await;
    101 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: implementation of `Send` is not general enough
       --> library/alloc/tests/autotraits.rs:103:5
        |
    103 | /     require_send_sync(async {
    104 | |         let _v = None::<alloc::collections::btree_map::OccupiedEntry<'_, &u32, &u32>>;
    105 | |         async {}.await;
    106 | |     });
        | |______^ implementation of `Send` is not general enough
        |
        = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
        = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: implementation of `Send` is not general enough
       --> library/alloc/tests/autotraits.rs:108:5
        |
    108 | /     require_send_sync(async {
    109 | |         let _v = None::<alloc::collections::btree_map::OccupiedError<'_, &u32, &u32>>;
    110 | |         async {}.await;
    111 | |     });
        | |______^ implementation of `Send` is not general enough
        |
        = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
        = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:113:5
        |
    113 | /     require_send_sync(async {
    114 | |         let _v = None::<alloc::collections::btree_map::Range<'_, &u32, &u32>>;
    115 | |         async {}.await;
    116 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: implementation of `Send` is not general enough
       --> library/alloc/tests/autotraits.rs:118:5
        |
    118 | /     require_send_sync(async {
    119 | |         let _v = None::<alloc::collections::btree_map::RangeMut<'_, &u32, &u32>>;
    120 | |         async {}.await;
    121 | |     });
        | |______^ implementation of `Send` is not general enough
        |
        = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
        = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: implementation of `Send` is not general enough
       --> library/alloc/tests/autotraits.rs:123:5
        |
    123 | /     require_send_sync(async {
    124 | |         let _v = None::<alloc::collections::btree_map::VacantEntry<'_, &u32, &u32>>;
    125 | |         async {}.await;
    126 | |     });
        | |______^ implementation of `Send` is not general enough
        |
        = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
        = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:128:5
        |
    128 | /     require_send_sync(async {
    129 | |         let _v = None::<alloc::collections::btree_map::Values<'_, &u32, &u32>>;
    130 | |         async {}.await;
    131 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: implementation of `Send` is not general enough
       --> library/alloc/tests/autotraits.rs:133:5
        |
    133 | /     require_send_sync(async {
    134 | |         let _v = None::<alloc::collections::btree_map::ValuesMut<'_, &u32, &u32>>;
    135 | |         async {}.await;
    136 | |     });
        | |______^ implementation of `Send` is not general enough
        |
        = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
        = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:146:5
        |
    146 | /     require_send_sync(async {
    147 | |         let _v = None::<alloc::collections::btree_set::Difference<'_, &u32>>;
    148 | |         async {}.await;
    149 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: implementation of `Send` is not general enough
       --> library/alloc/tests/autotraits.rs:151:5
        |
    151 | /     require_send_sync(async {
    152 | |         let _v = None::<alloc::collections::btree_set::DrainFilter<'_, &u32, fn(&&u32) -> bool>>;
    153 | |         async {}.await;
    154 | |     });
        | |______^ implementation of `Send` is not general enough
        |
        = note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
        = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:156:5
        |
    156 | /     require_send_sync(async {
    157 | |         let _v = None::<alloc::collections::btree_set::Intersection<'_, &u32>>;
    158 | |         async {}.await;
    159 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:166:5
        |
    166 | /     require_send_sync(async {
    167 | |         let _v = None::<alloc::collections::btree_set::Iter<'_, &u32>>;
    168 | |         async {}.await;
    169 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:171:5
        |
    171 | /     require_send_sync(async {
    172 | |         let _v = None::<alloc::collections::btree_set::Range<'_, &u32>>;
    173 | |         async {}.await;
    174 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:176:5
        |
    176 | /     require_send_sync(async {
    177 | |         let _v = None::<alloc::collections::btree_set::SymmetricDifference<'_, &u32>>;
    178 | |         async {}.await;
    179 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: higher-ranked lifetime error
       --> library/alloc/tests/autotraits.rs:181:5
        |
    181 | /     require_send_sync(async {
    182 | |         let _v = None::<alloc::collections::btree_set::Union<'_, &u32>>;
    183 | |         async {}.await;
    184 | |     });
        | |______^
        |
        = note: could not prove `impl Future<Output = ()>: Send`

    error: future cannot be sent between threads safely
       --> library/alloc/tests/autotraits.rs:243:23
        |
    243 |       require_send_sync(async {
        |  _______________________^
    244 | |         let _v =
    245 | |             None::<alloc::collections::linked_list::DrainFilter<'_, &u32, fn(&mut &u32) -> bool>>;
    246 | |         async {}.await;
    247 | |     });
        | |_____^ future created by async block is not `Send`
        |
        = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NonNull<std::collections::linked_list::Node<&u32>>`
    note: future is not `Send` as this value is used across an await
       --> library/alloc/tests/autotraits.rs:246:17
        |
    244 |         let _v =
        |             -- has type `Option<std::collections::linked_list::DrainFilter<'_, &u32, for<'a, 'b> fn(&'a mut &'b u32) -> bool>>` which is not `Send`
    245 |             None::<alloc::collections::linked_list::DrainFilter<'_, &u32, fn(&mut &u32) -> bool>>;
    246 |         async {}.await;
        |                 ^^^^^^ await occurs here, with `_v` maybe used later
    247 |     });
        |     - `_v` is later dropped here
    note: required by a bound in `require_send_sync`
       --> library/alloc/tests/autotraits.rs:3:25
        |
    3   | fn require_send_sync<T: Send + Sync>(_: T) {}
        |                         ^^^^ required by this bound in `require_send_sync`

    error: future cannot be shared between threads safely
       --> library/alloc/tests/autotraits.rs:243:23
        |
    243 |       require_send_sync(async {
        |  _______________________^
    244 | |         let _v =
    245 | |             None::<alloc::collections::linked_list::DrainFilter<'_, &u32, fn(&mut &u32) -> bool>>;
    246 | |         async {}.await;
    247 | |     });
        | |_____^ future created by async block is not `Sync`
        |
        = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `NonNull<std::collections::linked_list::Node<&u32>>`
    note: future is not `Sync` as this value is used across an await
       --> library/alloc/tests/autotraits.rs:246:17
        |
    244 |         let _v =
        |             -- has type `Option<std::collections::linked_list::DrainFilter<'_, &u32, for<'a, 'b> fn(&'a mut &'b u32) -> bool>>` which is not `Sync`
    245 |             None::<alloc::collections::linked_list::DrainFilter<'_, &u32, fn(&mut &u32) -> bool>>;
    246 |         async {}.await;
        |                 ^^^^^^ await occurs here, with `_v` maybe used later
    247 |     });
        |     - `_v` is later dropped here
    note: required by a bound in `require_send_sync`
       --> library/alloc/tests/autotraits.rs:3:32
        |
    3   | fn require_send_sync<T: Send + Sync>(_: T) {}
        |                                ^^^^ required by this bound in `require_send_sync`

20 months agoAuto merge of #102438 - andrewpollack:add-target-rustc-flags, r=Mark-Simulacrum
bors [Wed, 5 Oct 2022 17:54:32 +0000 (17:54 +0000)]
Auto merge of #102438 - andrewpollack:add-target-rustc-flags, r=Mark-Simulacrum

Adding target_rustcflags to `compiletest` TargetCfg creation

Adjustment to https://github.com/rust-lang/rust/pull/102134, ensures config returned by `rustc --target foo --print cfg` accurately reflects rustflags passed via `target_rustcflags`.

Fixes breaking change of not correctly handling `x.py test ... --test-args "--target-rustcflags -Cpanic=abort --target-rustcflags -Zpanic_abort_tests"`

cc `@djkoloski`

20 months agoUpdate compiler/rustc_hir_analysis/src/check/callee.rs
Michael Goulet [Wed, 5 Oct 2022 17:13:47 +0000 (10:13 -0700)]
Update compiler/rustc_hir_analysis/src/check/callee.rs

Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
20 months agoAuto merge of #9586 - Alexendoo:format-args-commas, r=Manishearth
bors [Wed, 5 Oct 2022 16:27:03 +0000 (16:27 +0000)]
Auto merge of #9586 - Alexendoo:format-args-commas, r=Manishearth

FormatArgsExpn: Find comma spans and ignore weird proc macro spans

Fixes the following cases:

A missing `, 1` from the `expect_fun_call` suggestion:

```rust
Some(()).expect(&format!("{x} {}", 1));
```
```
warning: use of `expect` followed by a function call
 --> t.rs:7:14
  |
7 |     Some(()).expect(&format!("{x} {}", 1));
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{x} {}"))`
```

The suggestion removing from the comma in the comment rather than the one after the format string:

```rust
println!(
    "{}",
    // a comment, with a comma in it
    x
);
```
```
warning: variables can be used directly in the `format!` string
  --> t.rs:9:5
   |
9  | /     println!(
10 | |         "{}",
11 | |         // a comment, with a comma in it
12 | |         x
13 | |     );
   | |_____^
   |
help: change this to
   |
10 ~         "{x}",
11 ~         // a comment
   |
```

It also no longer accepts expansions where a format string or argument has a "weird" proc macro span, that is one where the literal/expression it outputs has the span of one of its inputs. Kind of like a `format_args` specific `clippy_utils::is_from_proc_macro`, e.g. `format!(indoc! {" ... "})`

changelog: [`expect_fun_call`]: Fix suggestion for `format!` using captured variables
changelog: [`print_literal`], [`write_literal`], [`uninlined_format_args`]: Fix suggestion when following a comment including a comma

20 months agoFormatArgsExpn: Find comma spans and ignore weird proc macro spans
Alex Macleod [Wed, 5 Oct 2022 16:10:52 +0000 (16:10 +0000)]
FormatArgsExpn: Find comma spans and ignore weird proc macro spans

20 months agoAuto merge of #9495 - Alexendoo:disallowed-macros, r=Jarcho
bors [Wed, 5 Oct 2022 14:49:31 +0000 (14:49 +0000)]
Auto merge of #9495 - Alexendoo:disallowed-macros, r=Jarcho

Add `disallowed_macros` lint

Closes #7790
Fixes #9558

`clippy_utils::def_path_res` already resolved macro definitions which is nice, it just needed a tweak to be able to disambiguate e.g. `std::vec` the module & `std::vec` the macro, and `serde::Serialize` the trait & `serde::Serialize` the derive macro

changelog: new lint: [`disallowed_macros`]
changelog: [`disallowed_methods`], [`disallowed_types`]: Fix false negative when a type/fn/macro share the same path

20 months agoAuto merge of #102704 - Dylan-DPC:rollup-66ff8sm, r=Dylan-DPC
bors [Wed, 5 Oct 2022 14:48:17 +0000 (14:48 +0000)]
Auto merge of #102704 - Dylan-DPC:rollup-66ff8sm, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #100986 (Stop suggesting adding generic args for turbofish)
 - #101061 (panic-on-uninit: adjust checks to 0x01-filling)
 - #102440 (Only export `__tls_*` on wasm32-unknown-unknown.)
 - #102496 (Suggest `.into()` when all other coercion suggestions fail)
 - #102699 (Fix hamburger button color)

Failed merges:

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

20 months agofix doc and dedup diverge_cleanup
Ding Xiang Fei [Wed, 5 Oct 2022 14:24:12 +0000 (22:24 +0800)]
fix doc and dedup diverge_cleanup

20 months agoadd test for issue 82633
Rageking8 [Wed, 5 Oct 2022 13:54:59 +0000 (21:54 +0800)]
add test for issue 82633

20 months agosuggest `==` to the rest of assign expr
Takayuki Maeda [Wed, 5 Oct 2022 13:51:22 +0000 (22:51 +0900)]
suggest `==` to the rest of assign expr

20 months agouse smaller span
Takayuki Maeda [Wed, 5 Oct 2022 13:46:44 +0000 (22:46 +0900)]
use smaller span

20 months agoAdd `disallowed_macros` lint
Alex Macleod [Wed, 5 Oct 2022 13:44:01 +0000 (13:44 +0000)]
Add `disallowed_macros` lint

20 months agoRollup merge of #102699 - GuillaumeGomez:fix-hamburger-button-color, r=Dylan-DPC
Dylan DPC [Wed, 5 Oct 2022 11:57:34 +0000 (17:27 +0530)]
Rollup merge of #102699 - GuillaumeGomez:fix-hamburger-button-color, r=Dylan-DPC

Fix hamburger button color

Before:

![Screenshot from 2022-10-05 11-14-20](https://user-images.githubusercontent.com/3050060/194026621-e4df5750-92df-4194-a163-9787b45ace26.png)

After:

![Screenshot from 2022-10-05 11-14-15](https://user-images.githubusercontent.com/3050060/194026618-6a365623-5181-4174-b6af-66962e5ba6a5.png)

No need to backport it, beta doesn't seem affected.

r? `@notriddle`

20 months agoRollup merge of #102496 - compiler-errors:into-suggestion, r=davidtwco
Dylan DPC [Wed, 5 Oct 2022 11:57:33 +0000 (17:27 +0530)]
Rollup merge of #102496 - compiler-errors:into-suggestion, r=davidtwco

Suggest `.into()` when all other coercion suggestions fail

Also removes some bogus suggestions because we now short-circuit when offering coercion suggestions(instead of, for example, suggesting every one that could possibly apply)

Fixes #102415

20 months agoRollup merge of #102440 - sunfishcode:sunfishcode/wasm-no-export-tls-api, r=oli-obk
Dylan DPC [Wed, 5 Oct 2022 11:57:33 +0000 (17:27 +0530)]
Rollup merge of #102440 - sunfishcode:sunfishcode/wasm-no-export-tls-api, r=oli-obk

Only export `__tls_*` on wasm32-unknown-unknown.

From talking with `@abrown,` we aren't planning to have hosts call these `__tls_*` functions; instead, TLS initialization will be handled transparently within libc. Consequently, these functions don't need to be exported.

Leave them exported on wasm32-unknown-unknown though, as wasm-bindgen does call them.

20 months agoRollup merge of #101061 - RalfJung:panic-on-uninit, r=oli-obk
Dylan DPC [Wed, 5 Oct 2022 11:57:32 +0000 (17:27 +0530)]
Rollup merge of #101061 - RalfJung:panic-on-uninit, r=oli-obk

panic-on-uninit: adjust checks to 0x01-filling

Now that `mem::uninitiailized` actually fills memory with `0x01` (https://github.com/rust-lang/rust/pull/99182), we can make it panic in a few less cases without risking a lot more UB -- which hopefully slightly improves compatibility with some old code, and which might increase the chance that we can check inside arrays in the future.

We detect almost all of these with our lint, so authors of such code should still be warned -- but if this happens deep inside a dependency, the panic can be quite interruptive, so it might be better not to do it when there is no risk of LLVM UB.  Therefore, adjust the `might_permit_raw_init` logic to care primarily about LLVM UB. To my knowledge, it actually covers all cases of LLVM UB now.

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

Cc ``@5225225``

20 months agoRollup merge of #100986 - TaKO8Ki:do-not-suggest-adding-generic-args-for-turbofish...
Dylan DPC [Wed, 5 Oct 2022 11:57:31 +0000 (17:27 +0530)]
Rollup merge of #100986 - TaKO8Ki:do-not-suggest-adding-generic-args-for-turbofish, r=compiler-errors

Stop suggesting adding generic args for turbofish

Fixes #100137

20 months agoAuto merge of #98736 - alex:lipo-magic, r=bjorn3
bors [Wed, 5 Oct 2022 11:41:40 +0000 (11:41 +0000)]
Auto merge of #98736 - alex:lipo-magic, r=bjorn3

resolve error when attempting to link a universal library on macOS

Previously attempting to link universal libraries into libraries (but not binaries) would produce an error that "File too small to be an archive". This works around this by invoking `lipo -thin` to extract a library for the target platform when passed a univeral library.

Fixes #55235

It's worth acknowledging that this implementation is kind of a horrible hack. Unfortunately I don't know how to do anything better, hopefully this PR will be a jumping off point.

20 months agoAdd regression test for hamberger button color in mobile sidebar
Guillaume Gomez [Wed, 5 Oct 2022 09:20:14 +0000 (11:20 +0200)]
Add regression test for hamberger button color in mobile sidebar

20 months agoFix hamburger button color in mobile sidebar
Guillaume Gomez [Wed, 5 Oct 2022 09:19:53 +0000 (11:19 +0200)]
Fix hamburger button color in mobile sidebar

20 months agoAuto merge of #102691 - notriddle:rollup-tdtyagp, r=notriddle
bors [Wed, 5 Oct 2022 08:47:56 +0000 (08:47 +0000)]
Auto merge of #102691 - notriddle:rollup-tdtyagp, r=notriddle

Rollup of 5 pull requests

Successful merges:

 - #102574 (Make Hash{Set,Map}::with_hasher unstably const)
 - #102650 (Slightly improve no return for returning function error)
 - #102662 (rustdoc: remove no-op CSS `.code-header { display: block }`)
 - #102670 (follow-up fix about 101866 to print the self type.)
 - #102686 (Don't build the compiler before building rls)

Failed merges:

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

20 months agolint::unsafe_removed_from_name: fix false positive result when allowed
Andy-Python-Programmer [Wed, 5 Oct 2022 07:59:01 +0000 (18:59 +1100)]
lint::unsafe_removed_from_name: fix false positive result when allowed

* Allowing `unsafe_removed_from_name` on imports produces a false
positive on `useless_attribute`.

Fixes: #9197
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
20 months agostop suggesting adding generic args for turbofish
Takayuki Maeda [Wed, 5 Oct 2022 07:58:29 +0000 (16:58 +0900)]
stop suggesting adding generic args for turbofish

20 months agochange might_permit_raw_init to fully detect LLVM UB, but not more than that
Ralf Jung [Tue, 20 Sep 2022 09:33:16 +0000 (11:33 +0200)]
change might_permit_raw_init to fully detect LLVM UB, but not more than that

20 months agoSuggest calling method if fn does not exist
Michael Goulet [Wed, 5 Oct 2022 06:42:26 +0000 (06:42 +0000)]
Suggest calling method if fn does not exist

20 months agoDelay function resolution error until typeck
Michael Goulet [Wed, 5 Oct 2022 05:35:34 +0000 (05:35 +0000)]
Delay function resolution error until typeck