Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMediocre error message for f32/f64 ambiguity #47759
Comments
pietroalbini
added
C-enhancement
A-diagnostics
T-compiler
A-inference
labels
Jan 25, 2018
This comment has been minimized.
This comment has been minimized.
|
Note that type inference cannot figure out 2.0 is an f64 just by struct Foo;
trait Wat {
fn exp(self) -> Foo;
}
impl Wat for f32 {
fn exp(self) -> Foo { Foo }
}
impl std::ops::Mul<Foo> for f64 {
type Output = &'static str;
fn mul(self, _: Foo) -> &'static str {
"wat"
}
}
fn main() {
let _ = |x: f64| x * 2.0.exp();
//let _ = |x: f64| x * 2.0f64.exp();
} |
This comment has been minimized.
This comment has been minimized.
|
Yipes. Inference is definitely out. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nieksand commentedJan 25, 2018
I have this code:
https://play.rust-lang.org/?gist=58e23173aec4b798d8021af0ead25bbd&version=nightly
I get this error message:
I can work around by:
The world would be a better place if:
x{float}thing