Change:
! All pointing to the same impl: ! label +T-rustdoc
Actually, the never type , the trait and are not needed: It occurs with any type and any parameterized trait. Minimal reproducible example: The number of duplicates depends on the number of public types accessible in the target crate.
Taking a look.
code: Gives: !

Discussion:
/// This struct is used to wrap the `cache` and `tcx` in order to run `DocFolder`. struct CacheBuilder<'a, 'tcx> { cache: &'a mut Cache, <ins> /// This field is used to prevent duplicated impl blocks. impl_ids: FxHashMap<DefId, FxHashSet<DefId>>, </ins> tcx: TyCtxt<'tcx>, }

.insert(def_id, (vec![crate_name, prim.as_sym()], ItemType::Primitive)); } <del> krate = CacheBuilder { tcx, cache: &mut cx.cache }.fold_crate(krate); </del> <ins> let (krate, mut impl_ids) = { let mut cache_builder = CacheBuilder { tcx, cache: &mut cx.cache, impl_ids: FxHashMap::default() }; krate = cache_builder.fold_crate(krate); (krate, cache_builder.impl_ids) }; </ins> for (trait_did, dids, impl_) in cx.cache.orphan_trait_impls.drain(..) { if cx.cache.traits.contains_key(&trait_did) { for did in dids { <del> cx.cache.impls.entry(did).or_default().push(impl_.clone()); </del> <ins> if impl_ids.entry(did).or_default().insert(impl_.def_id()) { cx.cache.impls.entry(did).or_default().push(impl_.clone()); } </ins> } } }

let impl_item = Impl { impl_item: item }; if impl_item.trait_did().map_or(true, |d| self.cache.traits.contains_key(&d)) { for did in dids { <del> self.cache.impls.entry(did).or_insert_with(Vec::new).push(impl_item.clone()); </del> <ins> if self.impl_ids.entry(did).or_default().insert(impl_item.def_id()) { self.cache .impls .entry(did) .or_insert_with(Vec::new) .push(impl_item.clone()); } </ins> } } else { let trait_did = impl_item.trait_did().expect("no trait did");

crate use renderer::{run_format, FormatRenderer}; <del> use crate::clean; </del> <ins> use crate::clean::{self, ItemId}; </ins> /// Specifies whether rendering directly implemented trait items or ones from a certain Deref /// impl.

crate fn trait_did(&self) -> Option<DefId> { self.inner_impl().trait_.as_ref().map(|t| t.def_id()) } <ins> /// This function is used to extract a `DefId` to be used as a key for the `Cache::impls` field. /// /// It allows to prevent having duplicated implementations showing up (the biggest issue was /// with blanket impls). /// /// It panics if `self` is a `ItemId::Primitive`. crate fn def_id(&self) -> DefId { match self.impl_item.item_id { ItemId::Blanket { impl_id, .. } => impl_id, ItemId::Auto { trait_, .. } => trait_, ItemId::DefId(def_id) => def_id, ItemId::Primitive(_, _) => { panic!( "Unexpected ItemId::Primitive in expect_def_id: {:?}", self.impl_item.item_id ) } } } </ins> }

<ins> // This test ensures that the same implementation doesn't show more than once. // It's a regression test for https://github.com/rust-lang/rust/issues/96036. #![crate_name = "foo"] // We check that there is only one "impl<T> Something<Whatever> for T" listed in the // blanket implementations. // @has 'foo/struct.Whatever.html' // @count - '//*[@id="blanket-implementations-list"]/section[@class="impl has-srclink"]' 1 pub trait Something<T> { } pub struct Whatever; impl<T> Something<Whatever> for T {} </ins>