Open
Description
What is this
This is a design document for const generics. Any discussions about its content should be on zulip. The conclusions of these discussions should then be edited back into this issue. Please do not post any comments directly in this issue.
Content
trait Trait {
const Assoc: usize;
}
#[derive(Clone)]
struct SomeType<const N: usize>;
#[derive(Clone)]
struct Foo<T: Trait> {
value: SomeType<T::Assoc>,
}
The derive(Clone)
cannot distinguish whether T::Assoc
is a type or const argument. For type arguments it adds a where T::Assoc: Clone
bound to the generated impl. This will therefore likely have to fail wiht an error as the derive tries to emit a T::Assoc: Clone
bound which is not valid.