error[E0119]: conflicting implementations of trait `Trait<_>` --> $DIR/opaques.rs:27:1 | LL | impl Trait for T { | ---------------------- first implementation here ... LL | impl Trait for Alias { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error[E0282]: type annotations needed --> $DIR/opaques.rs:11:19 | LL | pub fn cast(x: Container, T>) -> Container { | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type error: aborting due to 2 previous errors Some errors have detailed explanations: E0119, E0282. For more information about an error, try `rustc --explain E0119`.