]> git.lizzy.rs Git - rust.git/log
rust.git
21 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

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

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

21 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

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

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

21 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

21 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

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

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

21 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

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

21 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

21 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

21 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

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

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

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

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

21 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

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

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

21 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

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

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

21 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

21 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

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

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

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

21 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

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

21 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

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

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

21 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

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

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

21 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

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

21 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

21 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

21 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

21 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

21 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

21 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

21 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

21 months agoRevert "Use getentropy when possible on all Apple platforms"
BlackHoleFox [Wed, 5 Oct 2022 05:48:22 +0000 (00:48 -0500)]
Revert "Use getentropy when possible on all Apple platforms"

This reverts commit 3fc35b5b935e390c61ea2bbf744838b2632b2df1.

21 months agoRollup merge of #102686 - cuviper:rls-tool_std, r=jyn514
Michael Howell [Wed, 5 Oct 2022 03:45:14 +0000 (20:45 -0700)]
Rollup merge of #102686 - cuviper:rls-tool_std, r=jyn514

Don't build the compiler before building rls

The rls stub is a simple stable tool, which doesn't need compiler libs.
(Similar to #97511)

21 months agoRollup merge of #102670 - lyming2007:issue-101866-fix, r=compiler-errors
Michael Howell [Wed, 5 Oct 2022 03:45:14 +0000 (20:45 -0700)]
Rollup merge of #102670 - lyming2007:issue-101866-fix, r=compiler-errors

follow-up fix about 101866 to print the self type.

modified:   compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
modified:   src/test/ui/error-codes/E0283.stderr
modified:   src/test/ui/error-codes/E0790.stderr
modified:   src/test/ui/traits/static-method-generic-inference.stderr
modified:   src/test/ui/type/issue-101866.stderr

21 months agoRollup merge of #102662 - notriddle:notriddle/code-header-display-block, r=GuillaumeGomez
Michael Howell [Wed, 5 Oct 2022 03:45:13 +0000 (20:45 -0700)]
Rollup merge of #102662 - notriddle:notriddle/code-header-display-block, r=GuillaumeGomez

rustdoc: remove no-op CSS `.code-header { display: block }`

Since 76a3b609d0b93c5d8da5e4e3db37bd03e5cb1c30 converted code headers to real headers, `display: block` is now the default.

21 months agoRollup merge of #102650 - Rageking8:slightly-improve-no-return-for-returning-function...
Michael Howell [Wed, 5 Oct 2022 03:45:13 +0000 (20:45 -0700)]
Rollup merge of #102650 - Rageking8:slightly-improve-no-return-for-returning-function-error, r=compiler-errors

Slightly improve no return for returning function error

Fixes #100607

The rationale is that absolute beginners will be slightly confused as to why certain lines of code in a function does not require a semicolon. (I have actually witness a beginner having this confusion). Hence, a slight rationale is added "to return this value", which signals to the user that after removing said semicolon the value is returned resolving that error.

However, if this is not desirable, I welcome any other suggestions. Thanks.

21 months agoRollup merge of #102574 - aDotInTheVoid:const_collections_with_hasher, r=oli-obk...
Michael Howell [Wed, 5 Oct 2022 03:45:12 +0000 (20:45 -0700)]
Rollup merge of #102574 - aDotInTheVoid:const_collections_with_hasher, r=oli-obk,fee1-dead

Make Hash{Set,Map}::with_hasher unstably const

Makes  [`HashMap::with_hasher`](https://doc.rust-lang.org/stable/std/collections/hash_map/struct.HashMap.html#method.with_hasher) and [`HashSet::with_hasher`](https://doc.rust-lang.org/stable/std/collections/hash_set/struct.HashSet.html#method.with_hasher) `const`.

This allows

```rust
static GlobalState: Mutex<HashMap<i32, i32, SomeHasher>> = Mutex::new(HashMap::with_hasher(SomeHasher::new()))
```

Tracking issue: #102575

21 months agoSuggest `.into()` when all other coercion suggestions fail
Michael Goulet [Fri, 30 Sep 2022 00:06:19 +0000 (00:06 +0000)]
Suggest `.into()` when all other coercion suggestions fail

21 months agoDon't build the compiler before building rls
Josh Stone [Wed, 5 Oct 2022 02:41:21 +0000 (19:41 -0700)]
Don't build the compiler before building rls

The rls stub is a simple stable tool, which doesn't need compiler libs.

21 months agoAuto merge of #102677 - weihanglo:update-cargo, r=ehuss
bors [Wed, 5 Oct 2022 02:14:13 +0000 (02:14 +0000)]
Auto merge of #102677 - weihanglo:update-cargo, r=ehuss

Update cargo

8 commits in f5fed93ba24607980647962c59863bbabb03ce14..0b84a35c2c7d70df4875a03eb19084b0e7a543ef 2022-09-27 12:03:57 +0000 to 2022-10-03 19:13:21 +0000

- Provide a better error message when mixing dep: with / (rust-lang/cargo#11172)
- Remove lingering unstable flag `-Zfeatures` (rust-lang/cargo#11168)
- Tweak wording (rust-lang/cargo#11164)
- Expose libgit2-sys/vendored feature as vendored-libgit2 (rust-lang/cargo#11162)
- refactor(cli): Upgrade to clap v4 (rust-lang/cargo#11159)
- Expose guide to adding a new edition as rustdoc (rust-lang/cargo#11157)
- Remove `multitarget` from -Zhelp (rust-lang/cargo#11158)
- Remove outdated comments (rust-lang/cargo#11155)

21 months agoTemporarily reinstate doctest=false
reez12g [Wed, 5 Oct 2022 00:53:49 +0000 (09:53 +0900)]
Temporarily reinstate doctest=false

21 months agoAuto merge of #101768 - sunfishcode:sunfishcode/wasi-stdio-lock-asfd, r=joshtriplett
bors [Tue, 4 Oct 2022 23:22:16 +0000 (23:22 +0000)]
Auto merge of #101768 - sunfishcode:sunfishcode/wasi-stdio-lock-asfd, r=joshtriplett

Add `AsFd` implementations for stdio lock types on WASI.

This mirrors the implementations on Unix platforms, and also mirrors the existing `AsRawFd` impls.

This is similar to #100892, but is for the `*Lock` types.

21 months agoUpdate cargo
Weihang Lo [Tue, 4 Oct 2022 20:57:49 +0000 (21:57 +0100)]
Update cargo

8 commits in f5fed93ba24607980647962c59863bbabb03ce14..0b84a35c2c7d70df4875a03eb19084b0e7a543ef
2022-09-27 12:03:57 +0000 to 2022-10-03 19:13:21 +0000

- Provide a better error message when mixing dep: with / (rust-lang/cargo#11172)
- Remove lingering unstable flag `-Zfeatures` (rust-lang/cargo#11168)
- Tweak wording (rust-lang/cargo#11164)
- Expose libgit2-sys/vendored feature as vendored-libgit2 (rust-lang/cargo#11162)
- refactor(cli): Upgrade to clap v4 (rust-lang/cargo#11159)
- Expose guide to adding a new edition as rustdoc (rust-lang/cargo#11157)
- Remove `multitarget` from -Zhelp (rust-lang/cargo#11158)
- Remove outdated comments (rust-lang/cargo#11155)

21 months agofollow-up fix about 101866 to print the self type.
Yiming Lei [Tue, 4 Oct 2022 17:30:25 +0000 (10:30 -0700)]
follow-up fix about 101866 to print the self type.
modified:   compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
modified:   src/test/ui/error-codes/E0283.stderr
modified:   src/test/ui/error-codes/E0790.stderr
modified:   src/test/ui/traits/static-method-generic-inference.stderr
modified:   src/test/ui/type/issue-101866.stderr

21 months agoAuto merge of #102666 - matthiaskrgr:rollup-tuge18t, r=matthiaskrgr
bors [Tue, 4 Oct 2022 16:29:26 +0000 (16:29 +0000)]
Auto merge of #102666 - matthiaskrgr:rollup-tuge18t, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #102241 (Package `rust-docs-json` into nightly components (take 3))
 - #102488 (Check generic argument compatibility when projecting assoc ty)
 - #102647 (Only allow ~const bounds for traits with #[const_trait])
 - #102648 (Add test for #102605)
 - #102651 (It's not about types or consts, but the lack of regions)
 - #102653 (resolve instance: missing value to `delay_span_bug`)

Failed merges:

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

21 months agoRollup merge of #102653 - lcnr:delay_span_bug, r=fee1-dead
Matthias Krüger [Tue, 4 Oct 2022 16:26:41 +0000 (18:26 +0200)]
Rollup merge of #102653 - lcnr:delay_span_bug, r=fee1-dead

resolve instance: missing value to `delay_span_bug`

21 months agoRollup merge of #102651 - oli-obk:non_region_things, r=lcnr
Matthias Krüger [Tue, 4 Oct 2022 16:26:41 +0000 (18:26 +0200)]
Rollup merge of #102651 - oli-obk:non_region_things, r=lcnr

It's not about types or consts, but the lack of regions

pulled out of https://github.com/rust-lang/rust/pull/101900 which adds a fourth kind of non-lifetime generic parameter, and the naming of these methods would get ridiculous.

21 months agoRollup merge of #102648 - Rageking8:add-test-for-#102605, r=compiler-errors
Matthias Krüger [Tue, 4 Oct 2022 16:26:40 +0000 (18:26 +0200)]
Rollup merge of #102648 - Rageking8:add-test-for-#102605, r=compiler-errors

Add test for #102605

Fixes #102605

21 months agoRollup merge of #102647 - oli-obk:tilde_const_bounds, r=fee1-dead
Matthias Krüger [Tue, 4 Oct 2022 16:26:39 +0000 (18:26 +0200)]
Rollup merge of #102647 - oli-obk:tilde_const_bounds, r=fee1-dead

Only allow ~const bounds for traits with #[const_trait]

r? `@fee1-dead`

21 months agoRollup merge of #102488 - compiler-errors:gat-compatibility, r=oli-obk
Matthias Krüger [Tue, 4 Oct 2022 16:26:39 +0000 (18:26 +0200)]
Rollup merge of #102488 - compiler-errors:gat-compatibility, r=oli-obk

Check generic argument compatibility when projecting assoc ty

Fixes #102114

21 months agoRollup merge of #102241 - jyn514:manifest-json-docs, r=Mark-Simulacrum
Matthias Krüger [Tue, 4 Oct 2022 16:26:38 +0000 (18:26 +0200)]
Rollup merge of #102241 - jyn514:manifest-json-docs, r=Mark-Simulacrum

Package `rust-docs-json` into nightly components (take 3)

`dist` creates a `rust-docs-json.tar.xz` tarfile. But build-manifest expected it to be named `rust-docs-json-preview.tar.xz`. Change build-manifest to allow the name without the `-preview` suffix.

I haven't actually tested this :( build-manifest is a pain to run locally.

21 months agorustdoc: remove no-op CSS `.code-header { display: block }`
Michael Howell [Tue, 4 Oct 2022 15:37:10 +0000 (08:37 -0700)]
rustdoc: remove no-op CSS `.code-header { display: block }`

Since 76a3b609d0b93c5d8da5e4e3db37bd03e5cb1c30 converted code headers to
real headers, `display: block` is now the default.

21 months agomissing value to delay_span_bug
lcnr [Tue, 4 Oct 2022 12:18:11 +0000 (14:18 +0200)]
missing value to delay_span_bug

21 months agotest Miri changes in PR CI; we no longer need xargo
Ralf Jung [Tue, 4 Oct 2022 13:23:57 +0000 (15:23 +0200)]
test Miri changes in PR CI; we no longer need xargo

21 months agoAuto merge of #2566 - saethlin:gc-cleanup, r=oli-obk
bors [Tue, 4 Oct 2022 14:17:17 +0000 (14:17 +0000)]
Auto merge of #2566 - saethlin:gc-cleanup, r=oli-obk

Expand VisitMachineValues to cover more pointers in the interpreter

Follow-on to https://github.com/rust-lang/miri/pull/2559

This is making me want to write a proc macro :thinking:

r? `@RalfJung`

21 months agoIt's not about types or consts, but the lack of regions
Oli Scherer [Tue, 4 Oct 2022 09:43:34 +0000 (09:43 +0000)]
It's not about types or consts, but the lack of regions

21 months agore-architect the tag visitor traits
Ralf Jung [Sun, 2 Oct 2022 14:22:53 +0000 (16:22 +0200)]
re-architect the tag visitor traits

21 months agoAuto merge of #2582 - RalfJung:sb-tracking, r=RalfJung
bors [Tue, 4 Oct 2022 13:44:21 +0000 (13:44 +0000)]
Auto merge of #2582 - RalfJung:sb-tracking, r=RalfJung

more details in stacked borrows tag tracking

21 months agoFinish TimeoutCallback
Ben Kimock [Tue, 27 Sep 2022 09:40:12 +0000 (05:40 -0400)]
Finish TimeoutCallback

21 months agoPlease help, where is this lifetime bound coming from
Ben Kimock [Tue, 27 Sep 2022 01:48:18 +0000 (21:48 -0400)]
Please help, where is this lifetime bound coming from

21 months agoUse static dispatch in the visitor
Ben Kimock [Mon, 26 Sep 2022 23:50:50 +0000 (19:50 -0400)]
Use static dispatch in the visitor

21 months agoUse VisitProvenance to factor allocation visiting better
Ben Kimock [Mon, 26 Sep 2022 22:06:20 +0000 (18:06 -0400)]
Use VisitProvenance to factor allocation visiting better

21 months agoA bit of cleanup
Ben Kimock [Mon, 26 Sep 2022 20:07:32 +0000 (16:07 -0400)]
A bit of cleanup

21 months agoExpand VisitMachineValues to cover more pointers in the interpreter
Ben Kimock [Sat, 24 Sep 2022 18:20:22 +0000 (14:20 -0400)]
Expand VisitMachineValues to cover more pointers in the interpreter

21 months agoAuto merge of #102652 - Dylan-DPC:rollup-6ff8ct8, r=Dylan-DPC
bors [Tue, 4 Oct 2022 13:04:57 +0000 (13:04 +0000)]
Auto merge of #102652 - Dylan-DPC:rollup-6ff8ct8, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #101189 (Implement `Ready::into_inner()`)
 - #101642 (Fix in-place collection leak when remaining element destructor panic)
 - #102489 (Normalize substs before resolving instance in `NoopMethodCall` lint)
 - #102559 (Don't ICE when trying to copy unsized value in const prop)
 - #102568 (Lint against nested opaque types that don't satisfy associated type bounds)
 - #102633 (Fix rustdoc ICE in invalid_rust_codeblocks lint)

Failed merges:

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

21 months agomore details on stacked borrows tracking
Ralf Jung [Tue, 4 Oct 2022 11:15:32 +0000 (13:15 +0200)]
more details on stacked borrows tracking

21 months agoresolve error when attempting to link a universal library on macOS
Alex Gaynor [Thu, 30 Jun 2022 19:01:38 +0000 (15:01 -0400)]
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 using `object` to extract a library for the target platform when passed a univeral library.

Fixes #55235

21 months agoslightly improve no return for returning function error
Rageking8 [Tue, 4 Oct 2022 08:46:12 +0000 (16:46 +0800)]
slightly improve no return for returning function error

21 months agoRollup merge of #102633 - Nilstrieb:rustdoc-lint-🏳️‍⚧️late, r=davidtwco
Dylan DPC [Tue, 4 Oct 2022 10:41:03 +0000 (16:11 +0530)]
Rollup merge of #102633 - Nilstrieb:rustdoc-lint-🏳️‍⚧️late, r=davidtwco

Fix rustdoc ICE in invalid_rust_codeblocks lint

The diagnostic message extraction code didn't handle translations yet.
Fixes #102603
Fixes #102631

r? `@davidtwco`

21 months agoRollup merge of #102568 - compiler-errors:lint-unsatisfied-opaques, r=oli-obk
Dylan DPC [Tue, 4 Oct 2022 10:41:02 +0000 (16:11 +0530)]
Rollup merge of #102568 - compiler-errors:lint-unsatisfied-opaques, r=oli-obk

Lint against nested opaque types that don't satisfy associated type bounds

See the test failures for examples of places where this lint would fire.

r? `@oli-obk`

21 months agoRollup merge of #102559 - compiler-errors:issue-102553, r=oli-obk
Dylan DPC [Tue, 4 Oct 2022 10:41:02 +0000 (16:11 +0530)]
Rollup merge of #102559 - compiler-errors:issue-102553, r=oli-obk

Don't ICE when trying to copy unsized value in const prop

When we have a trivially false where-clause predicate like `Self: Sized` where `Self = dyn Trait`, we sometimes don't throw an error during typeck for an illegal operation such as copying an unsized type.

This, unfortunately, cannot be made into an error (at least not without some migration -- see #95611 for example), but we should at least not ICE, since this function will never actually be reachable from main, for example.

r? `@RalfJung` since I think you added these assertions? but feel free to reassign.

Fixes #102553

21 months agoRollup merge of #102489 - compiler-errors:issue-102074, r=oli-obk
Dylan DPC [Tue, 4 Oct 2022 10:41:01 +0000 (16:11 +0530)]
Rollup merge of #102489 - compiler-errors:issue-102074, r=oli-obk

Normalize substs before resolving instance in `NoopMethodCall` lint

Fixes #102074

r? types

21 months agoRollup merge of #101642 - SkiFire13:fix-inplace-collection-leak, r=the8472
Dylan DPC [Tue, 4 Oct 2022 10:41:01 +0000 (16:11 +0530)]
Rollup merge of #101642 - SkiFire13:fix-inplace-collection-leak, r=the8472

Fix in-place collection leak when remaining element destructor panic

Fixes #101628

cc `@the8472`

I went for the drop guard route, placing it immediately before the `forget_allocation_drop_remaining` call and after the comment, as to signal they are closely related.

I also updated the test to check for the leak, though the only change really needed was removing the leak clean up for miri since now that's no longer leaked.

21 months agoRollup merge of #101189 - daxpedda:ready-into-inner, r=joshtriplett
Dylan DPC [Tue, 4 Oct 2022 10:41:00 +0000 (16:11 +0530)]
Rollup merge of #101189 - daxpedda:ready-into-inner, r=joshtriplett

Implement `Ready::into_inner()`

Tracking issue: #101196.

This implements a method to unwrap the value inside a `Ready` outside an async context.
See https://docs.rs/futures/0.3.24/futures/future/struct.Ready.html#method.into_inner for previous work.

This was discussed in [Zulip beforehand](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60Ready.3A.3Ainto_inner.28.29.60):
> An example I'm hitting right now:
I have a cross-platform library that provides a functions that returns a `Future`. The only reason why it returns a `Future` is because the WASM platform requires it, but the native doesn't, to make a cross-platform API that is equal for all I just return a `Ready` on the native targets.
>
> Now I would like to expose native-only functions that aren't async, that users can use to avoid having to deal with async when they are targeting native. With `into_inner` that's easily solvable now.
>
> I want to point out that some internal restructuring could be used to solve that problem too, but in this case it's not that simple, the library uses internal traits that return the `Future` already and playing around with that would introduce unnecessary `cfg` in a lot more places. So it is really only a quality-of-life feature.

21 months agoAuto merge of #102622 - camsteffen:move-layout, r=fee1-dead
bors [Tue, 4 Oct 2022 09:29:07 +0000 (09:29 +0000)]
Auto merge of #102622 - camsteffen:move-layout, r=fee1-dead

Move layout_of and friends from rustc_middle to rustc_ty_utils

Breaks up the very large module that is `rustc_middle::ty::layout` by fork-lifting some queries into `rustc_ty_utils::{abi, layout}`.

This does set back `rustc_ty_utils` to having untranslatable diagnostics. I'd like to leave this as a separate task.

21 months agoMerge the `~const` and `impl const` checks and add some explanatory notes
Oli Scherer [Tue, 4 Oct 2022 08:59:20 +0000 (08:59 +0000)]
Merge the `~const` and `impl const` checks and add some explanatory notes

21 months agoadd test for #102605
Rageking8 [Tue, 4 Oct 2022 08:13:50 +0000 (16:13 +0800)]
add test for #102605

21 months agoOnly allow ~const bounds for traits with #[const_trait]
Oli Scherer [Mon, 3 Oct 2022 17:08:42 +0000 (17:08 +0000)]
Only allow ~const bounds for traits with #[const_trait]

21 months agoAuto merge of #102644 - matthiaskrgr:rollup-rg0sw41, r=matthiaskrgr
bors [Tue, 4 Oct 2022 06:47:21 +0000 (06:47 +0000)]
Auto merge of #102644 - matthiaskrgr:rollup-rg0sw41, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #102441 (Suggest unwrap_or_else when a closure is given)
 - #102547 (Migrate CSS theme for search results)
 - #102567 (Delay evaluating lint primary message until after it would be suppressed)
 - #102624 (rustdoc: remove font family CSS on `.rustdoc-toggle summary::before`)
 - #102628 (Change the parameter name of From::from to `value`)
 - #102637 (Ignore fuchsia on two compiler tests)
 - #102639 (Improve spans when splitting multi-char operator tokens for proc macros.)

Failed merges:

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

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

21 months agoRollup merge of #102639 - nnethercote:improve-spans-splitting, r=Aaron1011
Matthias Krüger [Tue, 4 Oct 2022 04:14:13 +0000 (06:14 +0200)]
Rollup merge of #102639 - nnethercote:improve-spans-splitting, r=Aaron1011

Improve spans when splitting multi-char operator tokens for proc macros.

When a two-char (or three-char) operator token is split into single-char operator tokens before being passed to a proc macro, the single-char tokens are given the original span of length two (or three). This PR gives them more accurate spans.

r? `@Aaron1011`
cc `@petrochenkov`

21 months agoRollup merge of #102637 - andrewpollack:ignore-fuchsia-two-tests, r=tmandry
Matthias Krüger [Tue, 4 Oct 2022 04:14:12 +0000 (06:14 +0200)]
Rollup merge of #102637 - andrewpollack:ignore-fuchsia-two-tests, r=tmandry

Ignore fuchsia on two compiler tests

Adding `ignore-fuchsia` to two irrelevant compiler tests

cc. `@djkoloski`

r? `@tmandry`

21 months agoRollup merge of #102628 - H4x5:master, r=scottmcm
Matthias Krüger [Tue, 4 Oct 2022 04:14:12 +0000 (06:14 +0200)]
Rollup merge of #102628 - H4x5:master, r=scottmcm

Change the parameter name of From::from to `value`

The `From` trait is currently defined as:
```rust
pub trait From<T>: Sized {
    fn from(_: T) -> Self;
}
```

The name of the argument is `_`. I am proposing to change it to `value`, ie.
```rust
pub trait From<T>: Sized {
    fn from(value: T) -> Self;
}
```

This would be more consistent with the `TryFrom`, which looks like this:
```rust
pub trait TryFrom<T>: Sized {
    type Error;
    fn try_from(value: T) -> Result<Self, Self::Error>;
}
```

The reason for this proposal is twofold:
1. Consistency with the rest of the standard library. The `TryFrom` trait uses `value`, and no `From` implementation uses the default name (as it is quite useless).
2. When generating trait implementations with rust-analyzer/IntelliJ, the parameter name is copied, and it always has to be changed.

Optionally, another name like `x` could be used. I only propose `value` for consistency with `TryFrom`.

Changing parameter names is not a breaking change.

Note: this was originally posted as an internals thread [here](https://internals.rust-lang.org/t/change-the-argument-name-of-from-from/17480)

21 months agoRollup merge of #102624 - notriddle:notriddle/summary-before, r=GuillaumeGomez
Matthias Krüger [Tue, 4 Oct 2022 04:14:11 +0000 (06:14 +0200)]
Rollup merge of #102624 - notriddle:notriddle/summary-before, r=GuillaumeGomez

rustdoc: remove font family CSS on `.rustdoc-toggle summary::before`

This rule became irrelevant since c58246efe47bea09d4f3e70f536e4c9bb7770749 made it so that the `summary::before` pseudo-element contains an SVG instead of text.