Skip to content

Commit 386e5cd

Browse files
committed
Filter out negitive impls
1 parent e3429d7 commit 386e5cd

File tree

1 file changed

+9
-4
lines changed
  • src/librustdoc/html/render

1 file changed

+9
-4
lines changed

src/librustdoc/html/render/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,6 @@ fn render_impl(
15311531
let mut impl_items = Buffer::empty_from(w);
15321532
let mut default_impl_items = Buffer::empty_from(w);
15331533

1534-
// FFFFXXX
1535-
15361534
for trait_item in &i.inner_impl().items {
15371535
doc_impl_item(
15381536
&mut default_impl_items,
@@ -2336,18 +2334,25 @@ fn sidebar_trait(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, t: &clean
23362334

23372335
sidebar_assoc_items(cx, buf, it);
23382336

2339-
if let Some(implementors) = cache.implementors.get(&it.def_id.expect_def_id()) {
2337+
let did = it.def_id.expect_def_id();
2338+
2339+
if let Some(implementors) = cache.implementors.get(&did) {
23402340
let mut res = implementors
23412341
.iter()
23422342
.filter(|i| {
23432343
i.inner_impl().for_.def_id(cache).map_or(true, |d| cache.paths.contains_key(&d))
2344+
&& i.inner_impl().polarity == ty::ImplPolarity::Positive
23442345
})
23452346
// TODO: Dont do the filter map dance
23462347
// .filter_map(|i| extract_for_impl_name(&i.impl_item, cx))
23472348
.map(|i| {
23482349
(
23492350
format!("{:#}", i.inner_impl().for_.print(cx)),
2350-
cx.nixon_hack.borrow().get(&i.impl_item.def_id).unwrap().clone(),
2351+
cx.nixon_hack
2352+
.borrow()
2353+
.get(&i.impl_item.def_id)
2354+
.unwrap_or_else(|| panic!("Not in index {:#?}", i))
2355+
.clone(),
23512356
)
23522357
})
23532358
.collect::<Vec<_>>();

0 commit comments

Comments
 (0)