[Pre-pre RFC] Allow exclusion of trait methods for (certain) unsatisfiable where bounds
Rust Internals [Unofficial]
April 9, 2026
Apersoma:
Right now, there is no way to implement
Foofor a type that doesn't implementBarwithout refiningfn functo not have the bound, defeating its entire purpose.
You might be interested to learn that actually one can add the bound: For some reason, rustc doesn’t care so much anymore about “impossible” bounds if you add some higher-ranked lifetime to it. So e.g. while
impl Foo for SomeType {
fn func(self) -> Self
where
Self: Bar,
{
unreachable!()
}
}
is rejected, doing this instead is actually accepted:
impl Foo for SomeType {
fn func(self) -> Self
where
for<'a> Self: Bar,
{
unreachable!()
}
}
(equivalently: Self: for<'a> Bar. Also I somethimes would write this using for<'__> Self: Bar marking the name of the lifetime more clearly “irrelevant”, arguably.)
Discussion in the ATmosphere