[rust-dev] &self/&mut self in traits considered harmful(?)

Huon Wilson dbau.pp at gmail.com
Wed Jun 11 07:17:12 PDT 2014


On 11/06/14 23:27, SiegeLord wrote:
> Aside from somewhat more complicated impl's, are there any downsides 
> to never using anything but by value 'self' in traits?

Currently trait objects do not support `self` methods (#10672), and, 
generally, the interactions with trait objects seem peculiar, e.g. if 
you've implemented Trait for &Type, then you would want to be coercing a 
`&Type` to a `&Trait`, *not* a `&(&Type)` as is currently required.

However, I don't think these concerns affect the operator overloading 
traits.


https://github.com/mozilla/rust/issues/10672


Huon



More information about the Rust-dev mailing list