They aren't special. That one works because ()
is sized. See my thread here:
And a related RFC Issue:
With the unsize
feature, you could write:
#![feature(unsize)]
use std::marker::Unsize;
trait T {
fn foo<'a>(&'a self) where Self: 'a + Unsize<T + 'a> {
bar(self)
}
}
fn bar(x: &T) {}
fn baz(x: Box<T>) {
x.foo()
}
fn biz<V: T>(x: V) {
x.foo()
}
But it's rather messy, unstable, and has some weird edge cases.
1 Like