This question should’ve been posted on users.rust-lang.org.
This has nothing to do with inference.
When you write generic code, it needs to be valid for all possible types within the bounds you specify. The only thing that can be generically concluded from
<THaver as HasSomething>::TSomething is that it’s
Copy + PartialEq, as you specified in the trait definition. There are many types that are
Copy + PartialEq and most of them are no
usize. I can
impl HasSomething for another type (say
type TSomething = i32, and then construct a
Runner<File> and this must still work.
Maybe you meant to write
impl Runner<String> instead of
impl<THaver> Runner<THaver> where THaver: HasSomething?