Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
estebank opened this issue Jun 18, 2020 · 0 comments · Fixed by #73630
Closed

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

estebank opened this issue Jun 18, 2020 · 0 comments · Fixed by #73630
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

estebank commented Jun 18, 2020

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

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. labels Jun 18, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 23, 2020
@bors bors closed this as completed in 4f2e540 Jun 24, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant