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

On type error of closure call argument, point at earlier calls that affected inference #116250

Merged
merged 1 commit into from
Oct 10, 2023

Commits on Sep 28, 2023

  1. On type error of closure call argument, point at earlier calls that a…

    …ffected inference
    
    Mitigate part of  rust-lang#71209.
    
    ```
    error[E0308]: mismatched types
      --> $DIR/unboxed-closures-type-mismatch.rs:30:18
       |
    LL |         identity(1u16);
       |         -------- ^^^^ expected `u8`, found `u16`
       |         |
       |         arguments to this function are incorrect
       |
    note: expected because the closure was earlier called with an argument of type `u8`
      --> $DIR/unboxed-closures-type-mismatch.rs:29:18
       |
    LL |         identity(1u8);
       |         -------- ^^^ expected because this argument is of type `u8`
       |         |
       |         in this closure call
    note: closure parameter defined here
      --> $DIR/unboxed-closures-type-mismatch.rs:28:25
       |
    LL |         let identity = |x| x;
       |                         ^
    help: change the type of the numeric literal from `u16` to `u8`
       |
    LL |         identity(1u8);
       |                   ~~
       ```
    estebank committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    7bb594f View commit details
    Browse the repository at this point in the history