For both cases to work you must implement Into<Foo2> for both Foo and &Foo. If you only implement it for one of these, then in the other case you must borrow or dereference the Foo when calling into().
But compiler can't find the <Foo as Into<Foo2>>::into right? Only <&Foo as Into<Foo2>>::into be implemented in this case. So no multiple possible candidates and should not be conflicted?
Thanks and fully agree, I won't impl Into in real code. In here just try to show that two function signatures are the same.
Yes I agree, but I just want to know why . It's not a real problem in my code base.
No, every sized T implements From<T> and Into<T>, so this works for owned foo: Foo:
let _foo: Foo = foo.into();
You could implement Into<Foo2> for Foo and your OP would work. But x.into() will never autoref for a sized x as there is always a matching receiver before the autoref stage.