which should be reasonable since a default map is a map that holds no value, meaning its value type shouldn't have to implement Default trait. But the compiler doesn't let me.
My questions:
Is this an oversight on Rust part, a bug, or am I missing something?
There's nothing wrong with HashMap. If you read its docs, you can see that it implements Default even when the key and value types don't.
The problem is that you are deriving the default impl for your own, generic type, which automatically puts the Default trait bound on the type parameters (because that's the more common case, and it can't know you don't need it).
So, impl Default manually without adding the bounds to the key and value type. You'll see that HashMap::default() will work in that impl.
Yes, this is a bug. See this issue, which was closed in favor of this more general issue. You'll have to implement Default manually for now unfortunately.
Because it has made an intentional choice to make what it does not depend on implementation details of the type (its possibly-private fields), only on the exposed generic types.
Furthermore, in addition to what @scottmcm wrote, it's also not quite possible to account for every possible such implementation detail in fields without proper type checking, which, however, macros don't have access to.
I'm sorry but I don't really buy that argument. It is literally five lines: