These are chat archives for rust-lang/rust

22nd
Jan 2017
Thomas Koehler
@Bastacyclop
Jan 22 2017 11:53
is this a bug ? https://is.gd/xmVDLP
Sergey Noskov
@Albibek
Jan 22 2017 11:56
it doesn't seem so: you are returning values of different types from if/else branches, it's not possible.
In Rust, each function gets a unique type, the same way each closure has a unique type.
But you can convert function to a function pointer.
Thomas Koehler
@Bastacyclop
Jan 22 2017 12:31
ok thanks, I thought the conversion would be infered, it works without the tuple https://is.gd/l6F48b and with explicit type https://is.gd/Y5RpbU.