1
Fork 0

rustdoc: Refactor Impl.{synthetic,blanket_impl} into enum

This change has two advantages:

1. It makes the possible states clearer, and it makes it impossible to
   construct invalid states, such as a blanket impl that is also an auto
   trait impl.

2. It shrinks the size of `Impl` a bit, since now there is only one
   field, rather than two.
This commit is contained in:
Noah Lev 2021-11-06 23:10:01 -07:00
parent c32ee54380
commit 7b7023cb72
12 changed files with 66 additions and 36 deletions

View file

@ -228,7 +228,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
// Collect all the implementors of traits.
if let clean::ImplItem(ref i) = *item.kind {
if let Some(trait_) = &i.trait_ {
if i.blanket_impl.is_none() {
if !i.is_blanket_impl() {
self.cache
.implementors
.entry(trait_.def_id())