Comment by sophacles

10 months ago

That's just not true. If the user has defined on the struct and a trait also has the method name, the struct's impl is used. Multiple traits can have methods named the same too.

https://play.rust-lang.org/?version=stable&mode=debug&editio...

My comment might have been technically wrong as originally stated; I’ve since edited to try to correct/clarify.

What I really meant is the case where a method is added to a standard struct impl that conflicts with a user-defined trait.

For example, you might have implemented some trait OptionExt on Option with a method called foo. If now a method called foo is added to the standard option struct, it will conflict.