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 7 pull requests #121252

Merged
merged 16 commits into from
Feb 18, 2024
Merged

Rollup of 7 pull requests #121252

merged 16 commits into from
Feb 18, 2024

Commits on Jan 31, 2024

  1. Configuration menu
    Copy the full SHA
    d907a6b View commit details
    Browse the repository at this point in the history
  2. Add regression test for rust-lang#120471 to ensure that long crate na…

    …me are handled as expected on mobile
    GuillaumeGomez committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    5d29f5a View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2024

  1. Detect when method call on argument could be removed to fulfill faile…

    …d trait bound
    
    When encountering
    
    ```rust
    struct Foo;
    struct Bar;
    impl From<Bar> for Foo {
        fn from(_: Bar) -> Self { Foo }
    }
    fn qux(_: impl From<Bar>) {}
    fn main() {
        qux(Bar.into());
    }
    ```
    
    Suggest removing `.into()`:
    
    ```
    error[E0283]: type annotations needed
     --> f100.rs:8:13
      |
    8 |     qux(Bar.into());
      |     ---     ^^^^
      |     |
      |     required by a bound introduced by this call
      |
      = note: cannot satisfy `_: From<Bar>`
    note: required by a bound in `qux`
     --> f100.rs:6:16
      |
    6 | fn qux(_: impl From<Bar>) {}
      |                ^^^^^^^^^ required by this bound in `qux`
    help: try using a fully qualified path to specify the expected types
      |
    8 |     qux(<Bar as Into<T>>::into(Bar));
      |         +++++++++++++++++++++++   ~
    help: consider removing this method call, as the receiver has type `Bar` and `Bar: From<Bar>` can be fulfilled
      |
    8 -     qux(Bar.into());
    8 +     qux(Bar);
      |
    ```
    
    Fix rust-lang#71252
    estebank committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    9b3fcf9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5fbb1b2 View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2024

  1. Configuration menu
    Copy the full SHA
    f5d43a0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f62a695 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    38a2a65 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    62b789f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d988d8f View commit details
    Browse the repository at this point in the history

Commits on Feb 18, 2024

  1. Rollup merge of rust-lang#120526 - GuillaumeGomez:mobile-long-crate-n…

    …ame, r=notriddle
    
    rustdoc: Correctly handle long crate names on mobile
    
    Fixes rust-lang#120471.
    
    It now renders like this:
    
    ![image](https://github.com/rust-lang/rust/assets/3050060/065b4b8b-ba55-4163-a928-8d7bf735c111)
    
    r? `@notriddle`
    fmease committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    fb5982f View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#121100 - estebank:issue-71252, r=compiler-e…

    …rrors
    
    Detect when method call on argument could be removed to fulfill failed trait bound
    
    When encountering
    
    ```rust
    struct Foo;
    struct Bar;
    impl From<Bar> for Foo {
        fn from(_: Bar) -> Self { Foo }
    }
    fn qux(_: impl From<Bar>) {}
    fn main() {
        qux(Bar.into());
    }
    ```
    
    Suggest removing `.into()`:
    
    ```
    error[E0283]: type annotations needed
     --> f100.rs:8:13
      |
    8 |     qux(Bar.into());
      |     ---     ^^^^
      |     |
      |     required by a bound introduced by this call
      |
      = note: cannot satisfy `_: From<Bar>`
    note: required by a bound in `qux`
     --> f100.rs:6:16
      |
    6 | fn qux(_: impl From<Bar>) {}
      |                ^^^^^^^^^ required by this bound in `qux`
    help: try using a fully qualified path to specify the expected types
      |
    8 |     qux(<Bar as Into<T>>::into(Bar));
      |         +++++++++++++++++++++++   ~
    help: consider removing this method call, as the receiver has type `Bar` and `Bar: From<Bar>` trivially holds
      |
    8 -     qux(Bar.into());
    8 +     qux(Bar);
      |
    ```
    
    Fix rust-lang#71252
    fmease committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    6499eb5 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#121160 - fmease:rustdoc-fix-n-refactor-html…

    …-rendering, r=GuillaumeGomez
    
    rustdoc: fix and refactor HTML rendering a bit
    
    * refactoring: get rid of a bunch of manual `f.alternate()` branches
      * not sure why this wasn't done so already, is this perf-sensitive?
    * fix an ICE in debug builds of rustdoc
      * rustdoc used to crash on empty outlives-bounds: `where 'a:`
    * properly escape const generic defaults
    * actually print empty trait and outlives-bounds (doesn't work for cross-crate reexports yet, will fix that at some other point) since they can have semantic significance
      * outlives-bounds: forces lifetime params to be early-bound instead of late-bound which is technically speaking part of the public API
      * trait-bounds: can affect the well-formedness, consider
        * makeshift “const-evaluatable” bounds under `generic_const_exprs`
        * bounds to force wf-checking in light of rust-lang#100041 (quite artificial I know, I couldn't figure out something better), see rust-lang#121160 (comment)
    fmease committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    28c0fa8 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#121198 - clubby789:unnamed-fields-hir-check…

    …s, r=compiler-errors
    
    Add more checks for `unnamed_fields` during HIR analysis
    
    Fixes rust-lang#121151
    
    I also found that we don't prevent enums here so
    ```rs
    #[repr(C)]
    #[derive(Debug)]
    enum A {
        #[default]
        B,
        C,
    }
    
    #[repr(C)]
    #[derive(Debug)]
    struct D {
        _: A,
    }
    ```
    leads to an ICE on an `self.is_struct() || self.is_union()` assertion, so fixed that too.
    fmease committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    68cf537 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#121218 - ShoyuVanilla:fix-issue-76736, r=no…

    …triddle
    
    Fix missing trait impls for type in rustc docs
    
    Fixes rust-lang#76736
    fmease committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    8ba0ad0 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#121221 - fmease:refactor-astconv-assoc-item…

    …-bindings, r=compiler-errors
    
    AstConv: Refactor lowering of associated item bindings a bit
    
    Split off from rust-lang#119385 as discussed, namely the first two commits (modulo one `FIXME` getting turned into a `NOTE`).
    
    The second commit removes `astconv::ConvertedBinding{,Kind}` in favor of `hir::TypeBinding{,Kind}`. The former was a — in my opinion — super useless intermediary. As you can tell from the diff, its removal shaves off some code. Furthermore, yeeting it will make it easier to implement the type resolution fixes in rust-lang#119385.
    
    Nothing in this PR should have any semantic effect.
    
    r? `@compiler-errors`
    
    <sub>**Addendum** as in rust-lang#118668: What I call “associated item bindings” are commonly referred to as “type bindings” for historical reasons. Nowadays, “type bindings” include assoc type bindings, assoc const bindings and RTN (return type notation) which is why I prefer not to use this outdated term.</sub>
    fmease committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    9811358 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#121237 - Urgau:better-cargo-heuristic, r=co…

    …mpiler-errors
    
    Use better heuristic for printing Cargo specific diagnostics
    
    It was [reported](rust-lang#82450 (comment)) in the check-cfg call for testing that the Rust for Linux project is setting the `CARGO` env without compiling with it, which is an issue since we are using the `CARGO` env as a proxy for "was launched from Cargo".
    
    This PR switch to the `CARGO_CRATE_NAME` [Cargo env](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates), which shouldn't collide (as much) with other build systems. I also took the opportunity to consolidate all the checks under the same function.
    fmease committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    5628786 View commit details
    Browse the repository at this point in the history