impl Traits can be used as function arguments. Are there differences between this and a generic function with a trait constraint?
trait Foo {} fn func1(_: i
Both produce identical assembly, at least with the following simple test case:
trait Foo {} struct Bar; impl Foo for Bar {} fn func1(_: impl Foo) {} fn func2(_: T) {} fn main() { let x = Bar; let y = func1(x); // or func2(x); }