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

"Fallback" to i32/f32 in error messages involving numeric inference #26328

Closed
Aatch opened this issue Jun 16, 2015 · 2 comments
Closed

"Fallback" to i32/f32 in error messages involving numeric inference #26328

Aatch opened this issue Jun 16, 2015 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@Aatch
Copy link
Contributor

Aatch commented Jun 16, 2015

Currently error messages where the type of a variable is a integer variable or a float variable just put _ in for the type like a regular inference variable. For straight type mismatch errors, the elaborated version prints out something like an integral variable, which is fine, but other error messages don't. Like trait core::ops::Div<_> is not implemented for f64.

Given that we have fallbacks to i32 and f32 for integer and float literals respectively, it might be worth error messages acting as if that fallback has happened. trait core::ops::Div<i32> is not implemented for f64 is much more helpful, since it's fairly clear that the issue is that you're dividing a float by an integer.

@Aatch Aatch added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-diagnostics Area: Messages for errors, warnings, and lints labels Jun 16, 2015
@pnkfelix
Copy link
Member

dupe of #24770 ?

@alexcrichton
Copy link
Member

I'd agree this is a dupe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants