Stream: general

Topic: type inference bug?


Sebastian Köln (Mar 17 2020 at 18:03, on Zulip):

I have an interesting bug …
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=100150b71487fffe7113cd4078b66741

Sebastian Köln (Mar 17 2020 at 18:03, on Zulip):

if you change
y: 0.01 * 1i16.into()
to
y: 0.01 * 1i16 as f64
it works

bjorn3 (Mar 17 2020 at 18:06, on Zulip):

I believe it would be possible to implement Into<MyType> for i16 and Mul<RHS=MyType> for f64, in which case it is not known if f64 should be used or MyType.

Sebastian Köln (Mar 17 2020 at 18:09, on Zulip):

the funny thing is, that the error isn't even related to the closure

bjorn3 (Mar 17 2020 at 18:12, on Zulip):

You should probably report an issue for the bad error message.

Sebastian Köln (Mar 17 2020 at 18:12, on Zulip):

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c122d194c55598f418a68e169102ca73

Sebastian Köln (Mar 17 2020 at 18:24, on Zulip):

https://github.com/rust-lang/rust/issues/70082

Last update: May 29 2020 at 18:00UTC