You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I didn't even know constraining by something like f64: Mul<Self, Output=Self> was valid.
Binary operator overloads are somewhat unusual in that there is no inherent conceptual Self trait (lhs being chosen arbitrary), but for most traits there would be little reason to attempt to constrain it in this way. And really, there is not much reason I can see not to write:
pub trait M: Sized + Mul<f64, Output=Self>
nrc
added
the
T-lang
Relevant to the language team, which will review and decide on the RFC.
label
Aug 25, 2016
I would expect this code to compile, but it does not:
Having to repeat constraints leads to more verbose code and is only repeating information that the compiler already knows.
See previous discussion: rust-lang/rust#26564
The text was updated successfully, but these errors were encountered: