Closed
Description
Here is a sample code:
trait Inner<S> {}
trait MyTrait {
fn something<I: Inner<Self>>(i: I);
}
Which fails to compile with
error[E0277]: the size for values of type
Self
cannot be known at compilation time
--> src/lib.rs:4:5
|
4 | fn something<I: Inner>(i: I);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
OTOH if we add a special This
associated type then we are completely fine:
#![feature(associated_type_defaults)]
trait Inner<S> {}
trait MyTrait {
type This = Self;
fn something<I: Inner<Self::This>>(i: I);
}
It looks like an undesirable behavior.