Skip to content

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

Closed

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

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    D-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.
    on Jun 18, 2020
  2. added 2 commits that reference this issue on Jun 23, 2020
    07abff5
    4f2e540
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