Pre-RFC: Revamped const_trait_impl aka RFC 2632

I think the idea is that basically Default and const Default are two separate traits (but they are related of course, the latter implying the former). Then impl const Default for MyType makes sense. And impl<T: ~const Default> ~const Default for MyType<T> is basically syntactic sugar for

impl<C: constness, T: const(C) Default> const(C) Default for MyType<T> {}

which spells out impl<T: Default> Default for MyType<T> and impl<T: const Default> const Default for MyType<T> without repeating oneself.

That's also why ~const does not make sense in type definitions (to answer @CAD97 's question) -- it is sugar for implicitly referring to an unnamed C: constness parameter so that we can write an impl of the const and non-const trait at the same time.

3 Likes