Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/librustdoc/html/render/sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,10 @@ fn sidebar_trait<'a>(

sidebar_assoc_items(cx, it, blocks, deref_id_map);

if !t.is_dyn_compatible(tcx) {
blocks.push(LinkBlock::forced(
Link::new("dyn-compatibility", "Dyn Compatibility"),
"dyn-compatibility-note",
));
}
blocks.push(LinkBlock::forced(
Link::new("dyn-compatibility", "Dyn Compatibility"),
"dyn-compatibility-note",
));

blocks.push(LinkBlock::new(
Link::new("foreign-impls", "Implementations on Foreign Types"),
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-html/sidebar/sidebar-items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub trait Foo {
}

//@ has foo/trait.DynCompatible.html
//@ !has - '//div[@class="sidebar-elems"]//h3/a[@href="#dyn-compatibility"]' ''
//@ has - '//div[@class="sidebar-elems"]//h3/a[@href="#dyn-compatibility"]' ''
pub trait DynCompatible {
fn access(&self);
}
Expand Down
18 changes: 12 additions & 6 deletions tests/rustdoc-html/trait/trait-rustc_must_implement_one_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
//@ has - '//*[@class="stab must_implement"]/a[@href="#method.read"]' 'read'
//@ has - '//*[@class="stab must_implement"]/a[@href="#method.read_buf"]' 'read_buf'

// There should be 3 headings in the sidebar: Required/Provided methods and "Implementors".
//@ count - '//*[@id="rustdoc-toc"]/h3' 3
// There should be 4 headings in the sidebar: Required/Provided methods, "Implementors" and
// "Dyn Compatibility".
//@ count - '//*[@id="rustdoc-toc"]/h3' 4
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#required-methods"]' 'Required Methods'
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#provided-methods"]' 'Provided Methods'
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#dyn-compatibility"]' 'Dyn Compatibility'
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#implementors"]' 'Implementors'

#[rustc_must_implement_one_of(read_buf, read)]
Expand All @@ -25,10 +27,12 @@ pub trait Read {
}

//@ has 'foo/trait.Tadam.html'
// There should still be 3 headings in the sidebar: Required/Provided methods and "Implementors".
//@ count - '//*[@id="rustdoc-toc"]/h3' 3
// There should still be 4 headings in the sidebar: Required/Provided methods, "Implementors"
// and "Dyn Compatibility".
//@ count - '//*[@id="rustdoc-toc"]/h3' 4
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#required-methods"]' 'Required Methods'
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#provided-methods"]' 'Provided Methods'
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#dyn-compatibility"]' 'Dyn Compatibility'
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#implementors"]' 'Implementors'

#[rustc_must_implement_one_of(read_buf, read)]
Expand All @@ -39,9 +43,11 @@ pub trait Tadam {
}

//@ has 'foo/trait.Other.html'
// There should be 2 headings in the sidebar: Provided methods and "Implementors".
//@ count - '//*[@id="rustdoc-toc"]/h3' 2
// There should be 3 headings in the sidebar: Provided methods, "Implementors" and
// "Dyn Compatibility".
//@ count - '//*[@id="rustdoc-toc"]/h3' 3
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#provided-methods"]' 'Provided Methods'
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#dyn-compatibility"]' 'Dyn Compatibility'
//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#implementors"]' 'Implementors'

pub trait Other {
Expand Down