Skip to content

Explain why fn pointers for different fn items are different types #73487

Description

@estebank

Given

fn foo() {}
fn bar() {}

fn main() {
    let mut x = foo;
    x = bar;
}

The compiler should explain why foo and bar are not the same type and should suggest first changing x's type to fn() -> ().

taken from https://twitter.com/ekuber/status/1273753857542111237

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions