diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 3cd520fd4b50b..b8d774dac2f64 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -2575,13 +2575,14 @@ fn document(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item) -> fmt
}
/// Render md_text as markdown.
-fn render_markdown(w: &mut fmt::Formatter<'_>,
- cx: &Context,
- md_text: &str,
- links: Vec<(String, String)>,
- prefix: &str,
- is_hidden: bool)
- -> fmt::Result {
+fn render_markdown(
+ w: &mut fmt::Formatter<'_>,
+ cx: &Context,
+ md_text: &str,
+ links: Vec<(String, String)>,
+ prefix: &str,
+ is_hidden: bool,
+) -> fmt::Result {
let mut ids = cx.id_map.borrow_mut();
write!(w, "
{}{}
",
if is_hidden { " hidden" } else { "" },
@@ -2595,7 +2596,8 @@ fn document_short(
cx: &Context,
item: &clean::Item,
link: AssocItemLink<'_>,
- prefix: &str, is_hidden: bool
+ prefix: &str,
+ is_hidden: bool,
) -> fmt::Result {
if let Some(s) = item.doc_value() {
let markdown = if s.contains('\n') {
@@ -4248,9 +4250,10 @@ fn render_impl(w: &mut fmt::Formatter<'_>, cx: &Context, i: &Impl, link: AssocIt
RenderMode::ForDeref { mut_: deref_mut_ } => should_render_item(&item, deref_mut_),
};
- let (is_hidden, extra_class) = if trait_.is_none() ||
- item.doc_value().is_some() ||
- item.inner.is_associated() {
+ let (is_hidden, extra_class) = if (trait_.is_none() ||
+ item.doc_value().is_some() ||
+ item.inner.is_associated()) &&
+ !is_default_item {
(false, "")
} else {
(true, " hidden")
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 82d2c11b2497b..bc49d34b15bb3 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -3,7 +3,7 @@
// Local js definitions:
/* global addClass, getCurrentValue, hasClass */
-/* global isHidden onEach, removeClass, updateLocalStorage */
+/* global isHidden, onEach, removeClass, updateLocalStorage */
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(searchString, position) {
diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs
index ee622e74a08dc..bb6af7995a0ad 100644
--- a/src/test/rustdoc/assoc-consts.rs
+++ b/src/test/rustdoc/assoc-consts.rs
@@ -95,5 +95,5 @@ impl Qux for Bar {
/// Docs for QUX_DEFAULT1 in impl.
const QUX_DEFAULT1: i16 = 7;
// @has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
- // @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
+ // @has - '//*[@class="docblock hidden"]' "Docs for QUX_DEFAULT2 in trait."
}
diff --git a/src/test/rustdoc/inline_cross/assoc-items.rs b/src/test/rustdoc/inline_cross/assoc-items.rs
index d4f05bab5cabf..7eb3e43cb114e 100644
--- a/src/test/rustdoc/inline_cross/assoc-items.rs
+++ b/src/test/rustdoc/inline_cross/assoc-items.rs
@@ -16,15 +16,15 @@ extern crate assoc_items;
// @has - '//*[@id="associatedconstant.ConstNoDefault"]' 'const ConstNoDefault: i16'
// @has - '//*[@class="docblock"]' 'dox for ConstNoDefault'
// @has - '//*[@id="associatedconstant.ConstWithDefault"]' 'const ConstWithDefault: u16'
-// @has - '//*[@class="docblock"]' 'docs for ConstWithDefault'
+// @has - '//*[@class="docblock hidden"]' 'docs for ConstWithDefault'
// @has - '//*[@id="associatedtype.TypeNoDefault"]' 'type TypeNoDefault = i32'
// @has - '//*[@class="docblock"]' 'dox for TypeNoDefault'
// @has - '//*[@id="associatedtype.TypeWithDefault"]' 'type TypeWithDefault = u32'
-// @has - '//*[@class="docblock"]' 'docs for TypeWithDefault'
+// @has - '//*[@class="docblock hidden"]' 'docs for TypeWithDefault'
// @has - '//*[@id="method.method_no_default"]' 'fn method_no_default()'
// @has - '//*[@class="docblock"]' 'dox for method_no_default'
// @has - '//*[@id="method.method_with_default"]' 'fn method_with_default()'
-// @has - '//*[@class="docblock"]' 'docs for method_with_default'
+// @has - '//*[@class="docblock hidden"]' 'docs for method_with_default'
pub use assoc_items::MyStruct;
// @has foo/trait.MyTrait.html
diff --git a/src/test/rustdoc/inline_cross/impl-inline-without-trait.rs b/src/test/rustdoc/inline_cross/impl-inline-without-trait.rs
index cadeccb60c817..4591bb526ae77 100644
--- a/src/test/rustdoc/inline_cross/impl-inline-without-trait.rs
+++ b/src/test/rustdoc/inline_cross/impl-inline-without-trait.rs
@@ -8,5 +8,5 @@ extern crate impl_inline_without_trait;
// @has 'foo/struct.MyStruct.html'
// @has - '//*[@id="method.my_trait_method"]' 'fn my_trait_method()'
-// @has - '//*[@class="docblock"]' 'docs for my_trait_method'
+// @has - '//*[@class="docblock hidden"]' 'docs for my_trait_method'
pub use impl_inline_without_trait::MyStruct;
diff --git a/src/test/rustdoc/manual_impl.rs b/src/test/rustdoc/manual_impl.rs
index c9e4f4e0d3037..11ddab5f7ff26 100644
--- a/src/test/rustdoc/manual_impl.rs
+++ b/src/test/rustdoc/manual_impl.rs
@@ -24,10 +24,10 @@ pub trait T {
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait implementation.'
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait a_method implementation.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
-// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
-// @has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
+// @has - '//*[@class="docblock hidden"]' 'Docs associated with the trait b_method definition.'
+// @has - '//*[@class="docblock hidden"]' 'Docs associated with the trait c_method definition.'
// @!has - '//*[@class="docblock"]' 'There is another line'
-// @has - '//*[@class="docblock"]' 'Read more'
+// @has - '//*[@class="docblock hidden"]' 'Read more'
pub struct S1(usize);
/// Docs associated with the S1 trait implementation.
@@ -44,7 +44,7 @@ impl T for S1 {
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait c_method implementation.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
-// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
+// @has - '//*[@class="docblock hidden"]' 'Docs associated with the trait b_method definition.'
pub struct S2(usize);
/// Docs associated with the S2 trait implementation.