diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-08-19 12:26:47 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-19 12:26:47 +0530 |
| commit | ecd2885eedd62dba3744b5e5a7051c7bb6e1eca9 (patch) | |
| tree | 9eae3d73e1c14205d92ccc335008413b58fe7863 /src/librustdoc | |
| parent | 30e65cea07deacff8ab23388cf8ddf5e8b3caaaf (diff) | |
| parent | 748c6066551b2916726e0ec25b69120bb1c63b11 (diff) | |
| download | rust-ecd2885eedd62dba3744b5e5a7051c7bb6e1eca9.tar.gz rust-ecd2885eedd62dba3744b5e5a7051c7bb6e1eca9.zip | |
Rollup merge of #100731 - notriddle:notriddle/deref-methods-1, r=jsha
rustdoc: count deref and non-deref as same set of used methods Fixes #100679
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 5ed5299e09b..a8e32e84cbc 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1985,7 +1985,7 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) { { let mut derefs = FxHashSet::default(); derefs.insert(did); - sidebar_deref_methods(cx, out, impl_, v, &mut derefs); + sidebar_deref_methods(cx, out, impl_, v, &mut derefs, &mut used_links); } let format_impls = |impls: Vec<&Impl>, id_map: &mut IdMap| { @@ -2057,6 +2057,7 @@ fn sidebar_deref_methods( impl_: &Impl, v: &[Impl], derefs: &mut FxHashSet<DefId>, + used_links: &mut FxHashSet<String>, ) { let c = cx.cache(); @@ -2089,13 +2090,10 @@ fn sidebar_deref_methods( .and_then(|did| c.impls.get(&did)); if let Some(impls) = inner_impl { debug!("found inner_impl: {:?}", impls); - let mut used_links = FxHashSet::default(); let mut ret = impls .iter() .filter(|i| i.inner_impl().trait_.is_none()) - .flat_map(|i| { - get_methods(i.inner_impl(), true, &mut used_links, deref_mut, cx.tcx()) - }) + .flat_map(|i| get_methods(i.inner_impl(), true, used_links, deref_mut, cx.tcx())) .collect::<Vec<_>>(); if !ret.is_empty() { let id = if let Some(target_def_id) = real_target.def_id(c) { @@ -2124,7 +2122,14 @@ fn sidebar_deref_methods( .map(|t| Some(t.def_id()) == cx.tcx().lang_items().deref_trait()) .unwrap_or(false) }) { - sidebar_deref_methods(cx, out, target_deref_impl, target_impls, derefs); + sidebar_deref_methods( + cx, + out, + target_deref_impl, + target_impls, + derefs, + used_links, + ); } } } |
