Simply asking if this has been discussed yet. I cannot find anything in the history that exactly looks like this.
Consider the case where I have:
use core::ops::{Add};
struct Octets(u32);
impl From<u32> for Octets {
fn from(v: u32) -> Self { Self(v) }
}
impl Add for Octets {
type Output = Self;
fn add(self, rhs: Self) -> Self::Output {
Self(self.0 + rhs.0)
}
}
impl Octets {
fn is_divisible_by_3(self) -> bool {
(self.0 % 3) == 0
}
}
I would like if these can be merged into:
use core::ops::{Add};
struct Octets(u32);
impl Octets {
type Output = Self;
fn is_divisible_by_3(self) -> bool {
(self.0 % 3) == 0
}
fn From<u32>::from(v: u32) -> Self { Self(v) }
fn Add::add(self, rhs: Self) -> Self::Output {
Self(self.0 + rhs.0)
}
}
Note: Feature proposal: implementing multiple traits at once Does cover something similar however, their post is in regards to Super Traits rather than many distinct traits.
Maybe this looks too much like java?
lordan
January 22, 2026, 6:56pm
3
IMHO this would make it very hard to grasp what traits are being implemented. It's also not clear what parts of the impl block correspond to which trait. E.g., in your example type Output is separated from the add function implementation.
Also consider that you may have the same function names or associated types from different traits, that would then clash. E.g., you could have multiple implementations of Add with different Rhs types.
3 Likes
But of course you could make your own supertrait for the set of things you want to implement in one impl.
That way the impl would still be for some coherent set of things, rather than looking like an inherent impl but doing a whole bunch of random traits.
jrose
January 22, 2026, 10:06pm
5
You cannot, because you cannot blanket-impl Eq for all implementers of your supertrait.
What problem does this solve? Is there any usage pattern that’s currently inconvenient or impossible, but would work well with this proposed feature?
The closest thing I know of is https://github.com/rust-lang/rfcs/pull/3851
1 Like