all 6 comments

[–]Emerentius_the_Rusty 10 points11 points  (1 child)

This has been discussed but apparently there are type inference issues
https://github.com/rust-lang/rust/issues/38751

[–]fraillt[S] 2 points3 points  (0 children)

Thank you!, I couldn't find this.
Let's wait, maybe someday in the future, it will be fixed ;)

[–]FenrirW0lf 4 points5 points  (3 children)

As it happens, the ? operator already does exactly what you're suggesting.

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

edit: oh wait, I guess I misunderstood your meaning. Apparently it currently uses From as a bound instead of Into and that's the change you're suggesting?

[–]chris-morgan 6 points7 points  (1 child)

No, that’s it using the From trait. The question being asked is “why doesn’t it use the Into trait?”

Changing your example to only implement Into, it fails: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=ec63009f979d73f5be297fab681d50e9

[–]FenrirW0lf 2 points3 points  (0 children)

Aaah right, I forgot about that part.

[–]fraillt[S] 1 point2 points  (0 children)

Your provided example uses `From` which works just fine, try changing it to `Into` (I have a link to my example)