",
id, item_type, in_trait_class,
);
- render_rightside(w, cx, item, outer_version, outer_const_version);
+ render_rightside(w, cx, item, containing_item);
write!(w, "
", id);
w.write_str("
");
render_assoc_item(
@@ -1406,7 +1402,7 @@ fn render_impl(
"",
id, item_type, in_trait_class
);
- render_rightside(w, cx, item, outer_version, outer_const_version);
+ render_rightside(w, cx, item, containing_item);
write!(w, "
", id);
w.write_str("
");
assoc_const(
@@ -1461,11 +1457,10 @@ fn render_impl(
cx,
trait_item,
if trait_.is_some() { &i.impl_item } else { parent },
+ parent,
link,
render_mode,
false,
- outer_version,
- outer_const_version,
trait_.map(|t| &t.trait_),
show_def_docs,
);
@@ -1478,9 +1473,8 @@ fn render_impl(
t: &clean::Trait,
i: &clean::Impl,
parent: &clean::Item,
+ containing_item: &clean::Item,
render_mode: RenderMode,
- outer_version: Option<&str>,
- outer_const_version: Option<&str>,
show_def_docs: bool,
) {
for trait_item in &t.items {
@@ -1498,11 +1492,10 @@ fn render_impl(
cx,
trait_item,
parent,
+ containing_item,
assoc_link,
render_mode,
true,
- outer_version,
- outer_const_version,
Some(t),
show_def_docs,
);
@@ -1522,9 +1515,8 @@ fn render_impl(
&t.trait_,
&i.inner_impl(),
&i.impl_item,
+ parent,
render_mode,
- outer_version,
- outer_const_version,
show_def_docs,
);
}
@@ -1541,8 +1533,7 @@ fn render_impl(
cx,
i,
parent,
- outer_version,
- outer_const_version,
+ parent,
show_def_docs,
use_absolute,
is_on_foreign_type,
@@ -1578,12 +1569,13 @@ fn render_impl(
w.write_str(&close_tags);
}
+// Render the items that appear on the right side of methods, impls, and
+// associated types. For example "1.0.0 (const: 1.39.0) [src]".
fn render_rightside(
w: &mut Buffer,
cx: &Context<'_>,
item: &clean::Item,
- outer_version: Option<&str>,
- outer_const_version: Option<&str>,
+ containing_item: &clean::Item,
) {
let tcx = cx.tcx();
@@ -1592,8 +1584,8 @@ fn render_rightside(
w,
item.stable_since(tcx).as_deref(),
item.const_stable_since(tcx).as_deref(),
- outer_version,
- outer_const_version,
+ containing_item.stable_since(tcx).as_deref(),
+ containing_item.const_stable_since(tcx).as_deref(),
);
write_srclink(cx, item, w);
@@ -1605,8 +1597,7 @@ pub(crate) fn render_impl_summary(
cx: &Context<'_>,
i: &Impl,
parent: &clean::Item,
- outer_version: Option<&str>,
- outer_const_version: Option<&str>,
+ containing_item: &clean::Item,
show_def_docs: bool,
use_absolute: Option,
is_on_foreign_type: bool,
@@ -1630,7 +1621,7 @@ pub(crate) fn render_impl_summary(
format!(" data-aliases=\"{}\"", aliases.join(","))
};
write!(w, "", id, aliases);
- render_rightside(w, cx, &i.impl_item, outer_version, outer_const_version);
+ render_rightside(w, cx, &i.impl_item, containing_item);
write!(w, "
", id);
write!(w, "
");
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 8ad0a80344176..6eff452a13bdd 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -694,15 +694,12 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
write_small_section_header(w, "foreign-impls", "Implementations on Foreign Types", "");
for implementor in foreign {
- let outer_version = implementor.impl_item.stable_since(cx.tcx());
- let outer_const_version = implementor.impl_item.const_stable_since(cx.tcx());
render_impl_summary(
w,
cx,
&implementor,
it,
- outer_version.as_deref(),
- outer_const_version.as_deref(),
+ &implementor.impl_item,
false,
None,
true,
@@ -1319,15 +1316,12 @@ fn render_implementor(
} => implementor_dups[&path.last()].1,
_ => false,
};
- let outer_version = trait_.stable_since(cx.tcx());
- let outer_const_version = trait_.const_stable_since(cx.tcx());
render_impl_summary(
w,
cx,
implementor,
trait_,
- outer_version.as_deref(),
- outer_const_version.as_deref(),
+ trait_,
false,
Some(use_absolute),
false,
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index e6646586c4125..9a59ee528a0c9 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -1037,6 +1037,10 @@ a.test-arrow:hover{
opacity: 1;
}
+:target {
+ padding-right: 3px;
+}
+
.information {
position: absolute;
left: -25px;
diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css
index d220d8708a123..171d06c0a3667 100644
--- a/src/librustdoc/html/static/themes/ayu.css
+++ b/src/librustdoc/html/static/themes/ayu.css
@@ -334,8 +334,11 @@ a.test-arrow:hover {
color: #999;
}
-:target > code, :target > .in-band {
+:target, :target * {
background: rgba(255, 236, 164, 0.06);
+}
+
+:target {
border-right: 3px solid rgba(255, 180, 76, 0.85);
}
diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css
index 6385a763f2ef7..d9ea28058ad99 100644
--- a/src/librustdoc/html/static/themes/dark.css
+++ b/src/librustdoc/html/static/themes/dark.css
@@ -282,8 +282,11 @@ a.test-arrow:hover{
color: #999;
}
-:target > code, :target > .in-band {
+:target, :target * {
background-color: #494a3d;
+}
+
+:target {
border-right: 3px solid #bb7410;
}
diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css
index c19d5bfc317f7..a2dfb89820b01 100644
--- a/src/librustdoc/html/static/themes/light.css
+++ b/src/librustdoc/html/static/themes/light.css
@@ -275,8 +275,11 @@ a.test-arrow:hover{
color: #999;
}
-:target > code, :target > .in-band {
+:target, :target * {
background: #FDFFD3;
+}
+
+:target {
border-right: 3px solid #ffb44c;
}
diff --git a/src/test/rustdoc/ensure-src-link.rs b/src/test/rustdoc/ensure-src-link.rs
index 4b6270b26da27..6189acb72542a 100644
--- a/src/test/rustdoc/ensure-src-link.rs
+++ b/src/test/rustdoc/ensure-src-link.rs
@@ -2,5 +2,5 @@
// This test ensures that the [src] link is present on traits items.
-// @has foo/trait.Iterator.html '//div[@id="method.zip"]/a[@class="srclink"]' "[src]"
+// @has foo/trait.Iterator.html '//div[@id="method.zip"]//a[@class="srclink"]' "[src]"
pub use std::iter::Iterator;
diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs
index 5b7c04c0d4445..ddbe93febdc25 100644
--- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs
+++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs
@@ -38,23 +38,15 @@ impl MyTrait for Vec {
}
impl MyTrait for MyStruct {
- // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="type"]/@href' #associatedtype.Assoc
- // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc
type Assoc = bool;
- // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="constant"]/@href' #associatedconstant.VALUE
- // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE
const VALUE: u32 = 20;
- // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function-2"]//a[@class="fnname"]/@href' #tymethod.trait_function
- // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function-2"]//a[@class="anchor"]/@href' #method.trait_function-2
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.trait_function"]//a[@class="fnname"]/@href' trait.MyTrait.html#tymethod.trait_function
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function
fn trait_function(&self) {}
- // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.defaulted_override-3"]//a[@class="fnname"]/@href' #method.defaulted_override
- // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.defaulted_override-3"]//a[@class="anchor"]/@href' #method.defaulted_override-3
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.defaulted_override"]//a[@class="fnname"]/@href' trait.MyTrait.html#method.defaulted_override
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.defaulted_override"]//a[@class="anchor"]/@href' #method.defaulted_override
fn defaulted_override(&self) {}