Description
In the Object Safety section, it says:
- Explicitly non-dispatchable functions require:
- Have a
where Self: Sized
bound (receiver type ofSelf
(i.e.self
) implies this).
This implies that if you have any associated function with receiver of self
should be counted as non-dispatchable function. However, it is not the case. See the following code:
trait Foo {
fn a(self);
// fn b(self, x: &Self);
// fn c(self) -> Self;
}
fn test() -> Box<dyn Foo> { todo!() }
Uncommenting b
or c
would make the code fail to compile, unless explicit where Self: Sized
is added, but the rule in the reference indicates that having a receiver self
already implies that bound exists.
Not sure whether it's something that should be fixed in the reference or the compiler.