Hi
Given the following code:
#[derive(Copy, Clone)]
struct MyStruct;
trait MyTrait {}
impl MyTrait for MyStruct {}
fn do_smth0(_x: Option<MyStruct>) {}
fn do_smth1(_x: Option<impl MyTrait>) {}
fn do_smth2<T: Into<Option<MyStruct>>>(_x: T) {}
fn do_smth3<T: Into<Option<impl MyTrait>>>(_x: T) {} // problematic type inference
fn main() {
let x = MyStruct {};
do_smth0(Some(x)); // works
do_smth1(Some(x)); // works
do_smth2(x); // works
do_smth2(Some(x)); // works
do_smth3(x); // works!
do_smth3(Some(x)); // doesn't work
do_smth3(Some::<MyStruct>(x)); // works
}
The function do_smth3 needs extra type annotation for it to work when passing an Option, which seems inconsistent with do_smth2 and do_smth3 without an apparent Option.
Should I open an issue regarding this?