Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #103755

Merged
merged 20 commits into from
Oct 30, 2022
Merged

Rollup of 5 pull requests #103755

merged 20 commits into from
Oct 30, 2022

Commits on Oct 25, 2022

  1. Allow impl Fn() -> impl Trait in return position

    This allows writing the following function signatures:
    ```rust
    fn f0() -> impl Fn() -> impl Trait;
    fn f3() -> &'static dyn Fn() -> impl Trait;
    ```
    
    These signatures were already allowed for common traits and associated
    types, there is no reason why `Fn*` traits should be special in this
    regard.
    WaffleLapkin committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    8b494f4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7a4ba2f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    00f2277 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cc752f5 View commit details
    Browse the repository at this point in the history
  5. --bless

    WaffleLapkin committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    d116859 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    690e037 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e93982a View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2022

  1. Configuration menu
    Copy the full SHA
    be61f02 View commit details
    Browse the repository at this point in the history
  2. Add check to only output 'you might have meant' when the candidate na…

    …me is in the same crate
    zbyrn committed Oct 26, 2022
    Configuration menu
    Copy the full SHA
    0b936d2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    775328c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0eaf6d5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ddba6c1 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    06692ea View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2022

  1. Configuration menu
    Copy the full SHA
    17b86cb View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2022

  1. rustdoc: remove unnecessary .search-results { padding-bottom }

    There's nothing underneath it anyway. The conversation on
    b615c0c never really spelled out why it
    was added.
    notriddle committed Oct 29, 2022
    Configuration menu
    Copy the full SHA
    a3c56e0 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2022

  1. Rollup merge of rust-lang#93582 - WaffleLapkin:rpitirpit, r=compiler-…

    …errors
    
    Allow `impl Fn() -> impl Trait` in return position
    
    _This was originally proposed as part of rust-lang#93082 which was [closed](rust-lang#93082 (comment)) due to allowing `impl Fn() -> impl Trait` in argument position._
    
    This allows writing the following function signatures:
    ```rust
    fn f0() -> impl Fn() -> impl Trait;
    fn f3() -> &'static dyn Fn() -> impl Trait;
    ```
    
    These signatures were already allowed for common traits and associated types, there is no reason why `Fn*` traits should be special in this regard.
    
    `impl Trait` in both `f0` and `f3` means "new existential type", just like with `-> impl Iterator<Item = impl Trait>` and such.
    
    Arrow in `impl Fn() ->` is right-associative and binds from right to left, it's tested by [this test](https://github.com/WaffleLapkin/rust/blob/a819fecb8dea438fc70488ddec30a61e52942672/src/test/ui/impl-trait/impl_fn_associativity.rs).
    
    There even is a test that `f0` compiles:
    https://github.com/rust-lang/rust/blob/2f004d2d401682e553af3984ebd9a3976885e752/src/test/ui/impl-trait/nested_impl_trait.rs#L25-L28
    
    But it was changed in [PR 48084 (lines)](https://github.com/rust-lang/rust/pull/48084/files#diff-ccecca938872d65ffe8cd1c3ef1956e309fac83bcda547d8b16b89257e53a437R37)  to test the opposite, probably unintentionally given [PR 48084 (lines)](https://github.com/rust-lang/rust/pull/48084/files#diff-5a02f1ed43debed1fd24f7aad72490064f795b9420f15d847bac822aa4621a1cR476-R477).
    
    r? `@nikomatsakis`
    
    ----
    
    This limitation is especially annoying with async code, since it forces one to write this:
    ```rust
    trait AsyncFn3<A, B, C>: Fn(A, B, C) -> <Self as AsyncFn3<A, B, C>>::Future {
        type Future: Future<Output = Self::Out>;
    
        type Out;
    }
    
    impl<A, B, C, Fut, F> AsyncFn3<A, B, C> for F
    where
        F: Fn(A, B, C) -> Fut,
        Fut: Future,
    {
        type Future = Fut;
    
        type Out = Fut::Output;
    }
    
    fn async_closure() -> impl AsyncFn3<i32, i32, i32, Out = u32> {
        |a, b, c| async move { (a + b + c) as u32 }
    }
    ```
    Instead of:
    ```rust
    fn async_closure() -> impl Fn(i32, i32, i32) -> impl Future<Output = u32> {
        |a, b, c| async move { (a + b + c) as u32 }
    }
    ```
    Dylan-DPC authored Oct 30, 2022
    Configuration menu
    Copy the full SHA
    b4cf523 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#103560 - zbyrn:issue-103358-fix, r=cjgillot

    Point only to the identifiers in the typo suggestions of shadowed names instead of the entire struct
    
    Fixes rust-lang#103358.
    
    As discussed in the issue, the `Span` of the candidate `Ident` for a typo replacement is stored alongside its `Symbol` in `TypoSuggestion`. Then, the span of the identifier is what the "you might have meant to refer to" note is pointed at, rather than the entire struct definition.
    
    Comments in rust-lang#103111 and the issue both suggest that it is desirable to:
    1. include names defined in the same crate as the typo,
    2. ignore names defined elsewhere such as in `std`, _and_
    3. include names introduced indirectly via `use`.
    
    Since a name from another crate but introduced via `use` has non-local `def_id`, to achieve this, a suggestion is displayed if either the `def_id` of the suggested name is local, or the `span` of the suggested name is in the same file as the typo itself.
    
    Some UI tests have also been modified to reflect this change.
    
    r? `@cjgillot`
    Dylan-DPC authored Oct 30, 2022
    Configuration menu
    Copy the full SHA
    3143472 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#103588 - weihanglo:rustdoc/url-redirect, r=…

    …notriddle
    
    rustdoc: add missing URL redirect
    
    rust-lang#94753 missed some redirect settings, and one of the missing URL shows up in an error message. This PR adds those redirects.
    Dylan-DPC authored Oct 30, 2022
    Configuration menu
    Copy the full SHA
    8564ee8 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#103689 - saethlin:libtest-startup, r=thomcc

    Do fewer passes and generally be more efficient when filtering tests
    
    Follow-on of the work I started with this PR: rust-lang#99939
    
    Basically, the startup code for libtest is really inefficient, but that's not usually a problem because it is distributed in release and workloads are small. But under Miri which can be 100x slower than a debug build, these inefficiencies explode.
    
    Most of the diff here is making test filtering single-pass. There are a few other small optimizations as well, but they are more straightforward.
    
    With this PR, the startup time of the `iced` tests with `--features=code_asm,mvex` drops from 17 to 2 minutes (I think Miri has gotten slower under this workload since rust-lang#99939). The easiest way to try this out is to set `MIRI_LIB_SRC` to a checkout of this branch when running `cargo +nightly miri test --features=code_asm,mvex`.
    
    r? `@thomcc`
    Dylan-DPC authored Oct 30, 2022
    Configuration menu
    Copy the full SHA
    176a89f View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#103740 - notriddle:notriddle/search-results…

    …-padding-bottom, r=Dylan-DPC
    
    rustdoc: remove unnecessary CSS `.search-results { padding-bottom }`
    
    There's nothing underneath it anyway. The conversation on rust-lang#84462 never really spelled out why it was added.
    Dylan-DPC authored Oct 30, 2022
    Configuration menu
    Copy the full SHA
    df74f07 View commit details
    Browse the repository at this point in the history