diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 678e1762a5519..2eee60890e87d 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2243,14 +2243,7 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter, implementor_dups: &FxHashMap<&str, (DefId, bool)>) -> Result<(), fmt::Error> { - write!(w, "
")?;
+ write!(w, "")?;
// If there's already another implementor that has the same abbridged name, use the
// full path, for example in `std::iter::ExactSizeIterator`
let use_absolute = match implementor.inner_impl().for_ {
@@ -2269,7 +2262,14 @@ fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter,
write!(w, ";")?;
}
}
- writeln!(w, "
")?;
+ write!(w, "")?;
+ if let Some(l) = (Item { cx, item: &implementor.impl_item }).src_href() {
+ write!(w, "")?;
+ write!(w, "[src]",
+ l, "goto source code")?;
+ write!(w, "")?;
+ }
+ writeln!(w, "
")?;
Ok(())
}
@@ -3314,10 +3314,11 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
Some(ref t) => format!("impl-{}", small_url_encode(&format!("{:#}", t))),
None => "impl".to_string(),
});
- write!(w, "{}
",
+ write!(w, "
")?;
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
write!(w, "{}",
Markdown(&*dox, &i.impl_item.links()))?;
@@ -3357,19 +3357,20 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
write!(w, "", id, item_type)?;
write!(w, "{}", spotlight_decl(decl)?)?;
write!(w, "", ns_id)?;
- write!(w, "")?;
+ write!(w, "")?;
render_assoc_item(w, item, link.anchor(&id), ItemType::Impl)?;
write!(w, "
")?;
if let Some(l) = (Item { cx, item }).src_href() {
- write!(w, "")?;
+ write!(w, "")?;
write!(w, "")?;
render_stability_since_raw(w, item.stable_since(), outer_version)?;
write!(w, "[src]",
l, "goto source code")?;
} else {
+ write!(w, " ")?;
render_stability_since_raw(w, item.stable_since(), outer_version)?;
}
- write!(w, "\n")?;
+ write!(w, "
")?;
}
}
clean::TypedefItem(ref tydef, _) => {
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 9b899dd4517ea..5fb2aa4ef74f8 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -387,8 +387,6 @@ h4 > code, h3 > code, .invisible > code {
.content .in-band {
margin: 0px;
padding: 0px;
- display: inline-block;
- max-width: calc(100% - 43px);
}
.in-band > code {
@@ -403,7 +401,7 @@ h4 > code, h3 > code, .invisible > code {
font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
-.content table {
+.content table:not(.table-display) {
border-spacing: 0 5px;
border-collapse: separate;
}
@@ -470,7 +468,6 @@ h4 > code, h3 > code, .invisible > code {
.content .methods > div:not(.important-traits) { margin-left: 40px; }
.content .impl-items .docblock, .content .impl-items .stability {
- margin-left: 40px;
margin-bottom: .6em;
}
.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {
@@ -1254,3 +1251,28 @@ kbd {
/* important because of conflicting rule for small screens */
display: none !important;
}
+
+#implementations-list > h3 > span.in-band {
+ width: 100%;
+}
+
+.table-display {
+ width: 100%;
+ border: 0;
+ border-collapse: collapse;
+ border-spacing: 0;
+ font-size: 16px;
+}
+
+.table-display tr td:first-child {
+ padding-right: 0;
+}
+
+.table-display tr td:last-child {
+ float: right;
+}
+.table-display .out-of-band {
+ position: relative;
+ font-size: 19px;
+ display: block;
+}
diff --git a/src/test/rustdoc/synthetic_auto/complex.rs b/src/test/rustdoc/synthetic_auto/complex.rs
index 531798c30c656..a4ebf6d3a7e83 100644
--- a/src/test/rustdoc/synthetic_auto/complex.rs
+++ b/src/test/rustdoc/synthetic_auto/complex.rs
@@ -30,7 +30,7 @@ mod foo {
}
// @has complex/struct.NotOuter.html
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl<'a, T, K: \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'a, T, K: \
// ?Sized> Send for NotOuter<'a, T, K> where K: for<'b> Fn((&'b bool, &'a u8)) \
// -> &'b i8, T: MyTrait<'a>, >::MyItem: Copy, 'a: 'static"
diff --git a/src/test/rustdoc/synthetic_auto/lifetimes.rs b/src/test/rustdoc/synthetic_auto/lifetimes.rs
index 272925e5db542..1c1e7bc250526 100644
--- a/src/test/rustdoc/synthetic_auto/lifetimes.rs
+++ b/src/test/rustdoc/synthetic_auto/lifetimes.rs
@@ -18,10 +18,10 @@ where
{}
// @has lifetimes/struct.Foo.html
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl<'c, K> Send \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'c, K> Send \
// for Foo<'c, K> where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static"
//
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl<'c, K> Sync \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'c, K> Sync \
// for Foo<'c, K> where K: Sync"
pub struct Foo<'c, K: 'c> {
inner_field: Inner<'c, K>,
diff --git a/src/test/rustdoc/synthetic_auto/manual.rs b/src/test/rustdoc/synthetic_auto/manual.rs
index d81e6309dff61..ef6797ecf3c54 100644
--- a/src/test/rustdoc/synthetic_auto/manual.rs
+++ b/src/test/rustdoc/synthetic_auto/manual.rs
@@ -9,10 +9,10 @@
// except according to those terms.
// @has manual/struct.Foo.html
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' 'impl Sync for \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' 'impl Sync for \
// Foo where T: Sync'
//
-// @has - '//*[@id="implementations-list"]/*[@class="impl"]/*/code' \
+// @has - '//*[@id="implementations-list"]/*[@class="impl"]//*/code' \
// 'impl Send for Foo'
//
// @count - '//*[@id="implementations-list"]/*[@class="impl"]' 1
diff --git a/src/test/rustdoc/synthetic_auto/negative.rs b/src/test/rustdoc/synthetic_auto/negative.rs
index ec9cb710f1f8c..64480d28240b6 100644
--- a/src/test/rustdoc/synthetic_auto/negative.rs
+++ b/src/test/rustdoc/synthetic_auto/negative.rs
@@ -13,10 +13,10 @@ pub struct Inner {
}
// @has negative/struct.Outer.html
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl !Send for \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl !Send for \
// Outer"
//
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl \
// !Sync for Outer"
pub struct Outer {
inner_field: Inner,
diff --git a/src/test/rustdoc/synthetic_auto/nested.rs b/src/test/rustdoc/synthetic_auto/nested.rs
index 1f33a8b13cbf8..ccdbe159b6c5a 100644
--- a/src/test/rustdoc/synthetic_auto/nested.rs
+++ b/src/test/rustdoc/synthetic_auto/nested.rs
@@ -18,10 +18,10 @@ where
}
// @has nested/struct.Foo.html
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' 'impl Send for \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' 'impl Send for \
// Foo where T: Copy'
//
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' \
// 'impl Sync for Foo where T: Sync'
pub struct Foo {
inner_field: Inner,
diff --git a/src/test/rustdoc/synthetic_auto/no-redundancy.rs b/src/test/rustdoc/synthetic_auto/no-redundancy.rs
index 0b37f2ed31790..24fba221b9937 100644
--- a/src/test/rustdoc/synthetic_auto/no-redundancy.rs
+++ b/src/test/rustdoc/synthetic_auto/no-redundancy.rs
@@ -19,7 +19,7 @@ where
}
// @has no_redundancy/struct.Outer.html
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl Send for \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl Send for \
// Outer where T: Copy + Send"
pub struct Outer {
inner_field: Inner,
diff --git a/src/test/rustdoc/synthetic_auto/project.rs b/src/test/rustdoc/synthetic_auto/project.rs
index 977607fb14826..d588190c4f9d2 100644
--- a/src/test/rustdoc/synthetic_auto/project.rs
+++ b/src/test/rustdoc/synthetic_auto/project.rs
@@ -33,10 +33,10 @@ where
}
// @has project/struct.Foo.html
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl<'c, K> Send \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'c, K> Send \
// for Foo<'c, K> where K: MyTrait, 'c: 'static"
//
-// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl<'c, K> Sync \
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'c, K> Sync \
// for Foo<'c, K> where K: MyTrait, ::MyItem: OtherTrait, 'c: 'static,"
pub struct Foo<'c, K: 'c> {
inner_field: Inner<'c, K>,