-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I have this code:
let _ = |x: f64| x * 2.0.exp();
https://play.rust-lang.org/?gist=58e23173aec4b798d8021af0ead25bbd&version=nightly
I get this error message:
error[E0599]: no method named `exp` found for type `{float}` in the current scope
I can work around by:
let _ = |x: f64| x * 2.0f64.exp();
The world would be a better place if:
- Type inference could just figure out 2.0 has to be f64 given the type on
x
- Failing that, an error message indicating the problem is f32 vs f64 ambiguity rather than this mysterious
{float}
thing
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.