It is a technical requirement. By default, you can't have overlapping trait impls, since trait resolution breaks. With the default keyword, you opt in to this behavior, and accept that your own implementation may be overridden. That's not something you want to happen by default.
Eg I like to put fmt::Debug (if not derived) and fmt::Display in its own private strings.rs file. Documentation will show them just fine, everything works, but the implementations are 'hidden' away to reduce clutter.
How is this different than the default tag? I assume that all specializations will show up in the docs regardless.
This has nothing to do with the default tag. Your situation is just a matter of code organization within a single crate, whereas specialization has cross-crate implications.
7
u/Manishearth servo · rust · clippy May 27 '16
It is a technical requirement. By default, you can't have overlapping trait impls, since trait resolution breaks. With the
defaultkeyword, you opt in to this behavior, and accept that your own implementation may be overridden. That's not something you want to happen by default.This has nothing to do with the default tag. Your situation is just a matter of code organization within a single crate, whereas specialization has cross-crate implications.