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

Emit a hint for bad call return types due to generic arguments #106752

Merged
merged 1 commit into from
Jan 14, 2023

Commits on Jan 13, 2023

  1. Emit a hint for bad call return types due to generic arguments

    When the return type of a function call depends on the type of an
    argument, e.g.
    
    ```
    fn foo<T>(x: T) -> T {
        x
    }
    ```
    
    and the expected type is set due to either an explicitly typed
    binding, or because the call to the function is in a tail position
    without semicolon, the current error implies that the argument in the
    call has the wrong type.
    
    This new hint highlights that the expected type doesn't match the
    returned type, which matches the argument type, and that that's why
    we're flagging the argument type.
    
    Fixes rust-lang#43608.
    sulami committed Jan 13, 2023
    Configuration menu
    Copy the full SHA
    a3cf382 View commit details
    Browse the repository at this point in the history