diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs index 7b282b0c61d7e..6a7d9250319aa 100644 --- a/src/librustdoc/html/render/sidebar.rs +++ b/src/librustdoc/html/render/sidebar.rs @@ -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"), diff --git a/tests/rustdoc-html/sidebar/sidebar-items.rs b/tests/rustdoc-html/sidebar/sidebar-items.rs index bd0893dac3e36..19e6ab6d52580 100644 --- a/tests/rustdoc-html/sidebar/sidebar-items.rs +++ b/tests/rustdoc-html/sidebar/sidebar-items.rs @@ -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); } diff --git a/tests/rustdoc-html/trait/trait-rustc_must_implement_one_of.rs b/tests/rustdoc-html/trait/trait-rustc_must_implement_one_of.rs index 57accd9fa0791..40ca9ad8e3ff4 100644 --- a/tests/rustdoc-html/trait/trait-rustc_must_implement_one_of.rs +++ b/tests/rustdoc-html/trait/trait-rustc_must_implement_one_of.rs @@ -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)] @@ -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)] @@ -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 {