Ok, get it.
If I remove the impl From I still get the same error.
See play.rust-lang.org
use std::convert::TryFrom;
use std::io::{self, BufRead};
struct S;
impl<T: BufRead> TryFrom<T> for S {
type Error = ();
fn try_from(_value: T) -> Result<Self, Self::Error> {
Ok(S)
}
}
fn main() {
let _s1 = S::try_from(io::empty());
}
Edit: This seems to be this issue and specifically this blanket impl
impl<T, U> TryFrom<U> for T where U: Into<T> {
type Error = Infallible;
fn try_from(value: U) -> Result<Self, Self::Error> {
Ok(U::into(value))
}
}
Could you explain why this blanket impl applies here? Specifically I don't see where the where U: Into<T>
applies to my struct S
.