diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2022-06-04 11:03:45 -0700 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2022-06-04 11:10:51 -0700 |
| commit | 784eebcc604a10c697f6dce2f82155268333c57c (patch) | |
| tree | 8c8a8c30fe0754dcc3fdfdd4dae85fcdaf564bc9 /src/librustdoc/html/render/mod.rs | |
| parent | c7b0452ece11bf714f7cf2003747231931504d59 (diff) | |
| download | rust-784eebcc604a10c697f6dce2f82155268333c57c.tar.gz rust-784eebcc604a10c697f6dce2f82155268333c57c.zip | |
Don't generate "Impls on Foreign Types" for std
Hack: many traits and types in std are re-exported from core or alloc. In general, rustdoc is capable of recognizing these implementations as being on local types. However, in at least one case, rustdoc gets confused and labels an implementation as being on a foreign type. To make sure that confusion doesn't pass on to the reader, consider all implementations in std, core, and alloc to be on local types.
Diffstat (limited to 'src/librustdoc/html/render/mod.rs')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 0b801a20995..23ce634cf28 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2281,11 +2281,10 @@ fn sidebar_trait(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, t: &clean |sym| format!("<a href=\"#{1}.{0}\">{0}</a>", sym, ItemType::Method), ); - let cache = cx.cache(); - if let Some(implementors) = cache.implementors.get(&it.item_id.expect_def_id()) { + if let Some(implementors) = cx.cache().implementors.get(&it.item_id.expect_def_id()) { let mut res = implementors .iter() - .filter(|i| !i.is_on_local_type(cache)) + .filter(|i| !i.is_on_local_type(cx)) .filter_map(|i| extract_for_impl_name(&i.impl_item, cx)) .collect::<Vec<_>>(); |
