about summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-09 11:50:34 -0700
committerGitHub <noreply@github.com>2020-07-09 11:50:34 -0700
commit38541b742aae367796c537c8575cc30811d42fb1 (patch)
tree6d0e65c31db4f464a20a6cb9dd1676bfb58619ca /src/librustdoc/html/render.rs
parent89c9e970ddbe47622bcc52b135d35508510daa55 (diff)
parent368aa6f1e292d264bcb74fafa25069fe19c49450 (diff)
downloadrust-38541b742aae367796c537c8575cc30811d42fb1.tar.gz
rust-38541b742aae367796c537c8575cc30811d42fb1.zip
Rollup merge of #74107 - nbdd0121:rustdoc, r=GuillaumeGomez
Hide `&mut self` methods from Deref in sidebar if there are no `DerefMut` impl for the type.

This partially addresses #74083.
Diffstat (limited to 'src/librustdoc/html/render.rs')
-rw-r--r--src/librustdoc/html/render.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 69e3540ed62..f769a0920d1 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -4054,6 +4054,10 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
                         _ => None,
                     })
                 {
+                    let deref_mut = v
+                        .iter()
+                        .filter(|i| i.inner_impl().trait_.is_some())
+                        .any(|i| i.inner_impl().trait_.def_id() == c.deref_mut_trait_did);
                     let inner_impl = target
                         .def_id()
                         .or(target
@@ -4074,7 +4078,9 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
                         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, true))
+                            .flat_map(|i| {
+                                get_methods(i.inner_impl(), true, &mut used_links, deref_mut)
+                            })
                             .collect::<Vec<_>>();
                         // We want links' order to be reproducible so we don't use unstable sort.
                         ret.sort();