]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #100956 - GuillaumeGomez:reduce-rightside-dom-size, r=notriddle
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 26 Aug 2022 12:08:47 +0000 (14:08 +0200)
committerGitHub <noreply@github.com>
Fri, 26 Aug 2022 12:08:47 +0000 (14:08 +0200)
Reduce right-side DOM size

This is another follow-up of https://github.com/rust-lang/rust/pull/100429 but not in code blocks this time.

So the idea is: if there is only one element in the `.rightside` element, there is no need to wrap it, we can just create one node.

On each page, I run this JS: `document.getElementsByTagName('*').length`. Important to note: the bigger the number of elements inside the page, the greater the gain. It also doesn't work very nicely on std docs because there are a lot of version annotations. So with this PR, It allows to get the following results:

| file name | before this PR | with this PR | diff |
|-|-|-|-|
| std/default/trait.Default.html | 2189 | 1331 | 39.2% |
| std/vec/struct.Vec.html | 14073 | 13842 | 1.7% |
| std/fmt/trait.Debug.html | 5313 | 4907 | 7.7% |
| std/ops/trait.Index.html | 642 | 630 | 1.9% |
| gtk4/WidgetExt | 3269 | 3061 | 6.4% |

You can test it [here](https://rustdoc.crud.net/imperio/reduce-rightsize-dom-size/gtk4/prelude/trait.WidgetExt.html).

r? `@notriddle`

18 files changed:
src/librustdoc/html/render/mod.rs
src/librustdoc/html/render/print_item.rs
src/librustdoc/html/static/css/themes/ayu.css
src/librustdoc/html/static/css/themes/dark.css
src/librustdoc/html/static/css/themes/light.css
src/test/rustdoc-gui/anchors.goml
src/test/rustdoc-gui/headings.goml
src/test/rustdoc-gui/src/staged_api/Cargo.toml
src/test/rustdoc-gui/src/staged_api/lib.rs
src/test/rustdoc/anchors.no_const_anchor.html
src/test/rustdoc/anchors.no_const_anchor2.html
src/test/rustdoc/anchors.no_method_anchor.html
src/test/rustdoc/anchors.no_trait_method_anchor.html
src/test/rustdoc/anchors.no_tymethod_anchor.html
src/test/rustdoc/anchors.no_type_anchor.html
src/test/rustdoc/ensure-src-link.rs
src/test/rustdoc/src-links-auto-impls.rs
src/test/rustdoc/version-separator-without-source.rs

index f9d6b4619cc77999e44c7151aa410464cf6ff2c3..b1d2872019ef6f3b7d137e5abf3d4ca4d92bbe10 100644 (file)
@@ -191,12 +191,6 @@ pub(crate) fn basename(&self) -> Result<String, Error> {
     }
 }
 
-fn write_srclink(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer) {
-    if let Some(l) = cx.src_href(item) {
-        write!(buf, "<a class=\"srclink\" href=\"{}\">source</a>", l)
-    }
-}
-
 #[derive(Debug, Eq, PartialEq, Hash)]
 struct ItemEntry {
     url: String,
@@ -840,12 +834,13 @@ fn assoc_method(
 /// Note that it is possible for an unstable function to be const-stable. In that case, the span
 /// will include the const-stable version, but no stable version will be emitted, as a natural
 /// consequence of the above rules.
-fn render_stability_since_raw(
+fn render_stability_since_raw_with_extra(
     w: &mut Buffer,
     ver: Option<Symbol>,
     const_stability: Option<ConstStability>,
     containing_ver: Option<Symbol>,
     containing_const_ver: Option<Symbol>,
+    extra_class: &str,
 ) -> bool {
     let stable_version = ver.filter(|inner| !inner.is_empty() && Some(*inner) != containing_ver);
 
@@ -893,12 +888,30 @@ fn render_stability_since_raw(
     }
 
     if !stability.is_empty() {
-        write!(w, r#"<span class="since" title="{}">{}</span>"#, title, stability);
+        write!(w, r#"<span class="since{extra_class}" title="{title}">{stability}</span>"#);
     }
 
     !stability.is_empty()
 }
 
+#[inline]
+fn render_stability_since_raw(
+    w: &mut Buffer,
+    ver: Option<Symbol>,
+    const_stability: Option<ConstStability>,
+    containing_ver: Option<Symbol>,
+    containing_const_ver: Option<Symbol>,
+) -> bool {
+    render_stability_since_raw_with_extra(
+        w,
+        ver,
+        const_stability,
+        containing_ver,
+        containing_const_ver,
+        "",
+    )
+}
+
 fn render_assoc_item(
     w: &mut Buffer,
     item: &clean::Item,
@@ -1681,23 +1694,29 @@ fn render_rightside(
         RenderMode::Normal => (item.const_stability(tcx), containing_item.const_stable_since(tcx)),
         RenderMode::ForDeref { .. } => (None, None),
     };
+    let src_href = cx.src_href(item);
+    let has_src_ref = src_href.is_some();
 
     let mut rightside = Buffer::new();
-    let has_stability = render_stability_since_raw(
+    let has_stability = render_stability_since_raw_with_extra(
         &mut rightside,
         item.stable_since(tcx),
         const_stability,
         containing_item.stable_since(tcx),
         const_stable_since,
+        if has_src_ref { "" } else { " rightside" },
     );
-    let mut srclink = Buffer::empty_from(w);
-    write_srclink(cx, item, &mut srclink);
-    if has_stability && !srclink.is_empty() {
-        rightside.write_str(" · ");
+    if let Some(l) = src_href {
+        if has_stability {
+            write!(rightside, " · <a class=\"srclink\" href=\"{}\">source</a>", l)
+        } else {
+            write!(rightside, "<a class=\"srclink rightside\" href=\"{}\">source</a>", l)
+        }
     }
-    rightside.push_buffer(srclink);
-    if !rightside.is_empty() {
+    if has_stability && has_src_ref {
         write!(w, "<span class=\"rightside\">{}</span>", rightside.into_inner());
+    } else {
+        w.push_buffer(rightside);
     }
 }
 
index 6d0a825fec866aa47a7c04bd4bdb29d5dd1a056c..a5668b318dcdc8f18a60e560e6754af8db65b54a 100644 (file)
@@ -18,7 +18,7 @@
 use super::{
     collect_paths_for_type, document, ensure_trailing_slash, item_ty_to_section,
     notable_traits_decl, render_assoc_item, render_assoc_items, render_attributes_in_code,
-    render_attributes_in_pre, render_impl, render_stability_since_raw, write_srclink,
+    render_attributes_in_pre, render_impl, render_rightside, render_stability_since_raw,
     AssocItemLink, Context, ImplRenderingParameters,
 };
 use crate::clean;
@@ -709,14 +709,7 @@ fn trait_item(w: &mut Buffer, cx: &mut Context<'_>, m: &clean::Item, t: &clean::
             write!(w, "<details class=\"rustdoc-toggle\" open><summary>");
         }
         write!(w, "<div id=\"{}\" class=\"method has-srclink\">", id);
-        write!(w, "<div class=\"rightside\">");
-
-        let has_stability = render_stability_since(w, m, t, cx.tcx());
-        if has_stability {
-            w.write_str(" · ");
-        }
-        write_srclink(cx, m, w);
-        write!(w, "</div>");
+        render_rightside(w, cx, m, t, RenderMode::Normal);
         write!(w, "<h4 class=\"code-header\">");
         render_assoc_item(
             w,
@@ -1260,7 +1253,13 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
                 w.write_str(")");
             }
             w.write_str("</code>");
-            render_stability_since(w, variant, it, cx.tcx());
+            render_stability_since_raw(
+                w,
+                variant.stable_since(cx.tcx()),
+                variant.const_stability(cx.tcx()),
+                it.stable_since(cx.tcx()),
+                it.const_stable_since(cx.tcx()),
+            );
             w.write_str("</h3>");
 
             use crate::clean::Variant;
@@ -1591,21 +1590,6 @@ fn wrap_item<F>(w: &mut Buffer, item_name: &str, f: F)
     w.write_str("</code></pre>");
 }
 
-fn render_stability_since(
-    w: &mut Buffer,
-    item: &clean::Item,
-    containing_item: &clean::Item,
-    tcx: TyCtxt<'_>,
-) -> bool {
-    render_stability_since_raw(
-        w,
-        item.stable_since(tcx),
-        item.const_stability(tcx),
-        containing_item.stable_since(tcx),
-        containing_item.const_stable_since(tcx),
-    )
-}
-
 fn compare_impl<'a, 'b>(lhs: &'a &&Impl, rhs: &'b &&Impl, cx: &Context<'_>) -> Ordering {
     let lhss = format!("{}", lhs.inner_impl().print(false, cx));
     let rhss = format!("{}", rhs.inner_impl().print(false, cx));
index 63009006b3f1f906a2fb449ed130fc0a84535b07..8591f22d6de608987b54f1f21a035402da8d8649 100644 (file)
@@ -199,7 +199,7 @@ details.rustdoc-toggle > summary::before {
        background: none;
 }
 
-.rightside,
+.rightside:not(a),
 .out-of-band {
        color: grey;
 }
index 1fcda22b6f4fa8027ec92178f4d653cf71080f6d..d5cd47c3e19d5f00c5c4245c7bd1195e4ea937a3 100644 (file)
@@ -165,7 +165,7 @@ details.rustdoc-toggle > summary::before {
        background: none;
 }
 
-.rightside,
+.rightside:not(a),
 .out-of-band {
        color: grey;
 }
index 7139c199729ae989cfc7c424d7a4ddf91d565ec4..cff70268144f35852468925b80424e7c1fdcc47d 100644 (file)
@@ -148,7 +148,7 @@ details.rustdoc-toggle > summary::before {
 .stab { background: #FFF5D6; border-color: #FFC600; }
 .stab.portability > code { background: none; }
 
-.rightside,
+.rightside:not(a),
 .out-of-band {
        color: grey;
 }
index 84b8bbd1b327f1c8431fd104e70ce04727814a5b..3ad62c721b4b83768cb40efbc6fbdddb037855d3 100644 (file)
@@ -1,6 +1,5 @@
 // This test is to ensure that the anchors (`§`) have the expected color and position.
-goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
-show-text: true
+goto: file://|DOC_PATH|/staged_api/struct.Foo.html
 
 // This is needed to ensure that the text color is computed.
 show-text: true
@@ -13,10 +12,31 @@ reload:
 assert-css: ("#toggle-all-docs", {"color": "rgb(0, 0, 0)"})
 assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
 assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 55, 138)"})
-assert-css: (".srclink", {"color": "rgb(56, 115, 173)"})
+assert-css: (
+    ".rightside .srclink",
+    {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
+    ALL,
+)
+compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
+compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])
 
 move-cursor-to: ".main-heading .srclink"
-assert-css: (".srclink", {"text-decoration": "underline solid rgb(56, 115, 173)"})
+assert-css: (
+    ".main-heading .srclink",
+    {"color": "rgb(56, 115, 173)", "text-decoration": "underline solid rgb(56, 115, 173)"},
+)
+move-cursor-to: ".impl-items .rightside .srclink"
+assert-css: (
+    ".impl-items .rightside .srclink",
+    {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
+)
+move-cursor-to: ".impl-items .rightside.srclink"
+assert-css: (
+    ".impl-items .rightside.srclink",
+    {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
+)
+
+goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
 
 assert-css: ("#top-doc-prose-title", {"color": "rgb(0, 0, 0)"})
 
@@ -32,3 +52,103 @@ move-cursor-to: "#impl-HeavilyDocumentedStruct"
 assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": "rgb(0, 0, 0)"})
 
 assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
+
+//
+// We do the same checks with the dark theme now.
+//
+local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
+goto: file://|DOC_PATH|/staged_api/struct.Foo.html
+
+assert-css: ("#toggle-all-docs", {"color": "rgb(221, 221, 221)"})
+assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(221, 221, 221)"})
+assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(45, 191, 184)"})
+assert-css: (
+    ".rightside .srclink",
+    {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
+    ALL,
+)
+compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
+compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])
+
+move-cursor-to: ".main-heading .srclink"
+assert-css: (
+    ".main-heading .srclink",
+    {"color": "rgb(210, 153, 29)", "text-decoration": "underline solid rgb(210, 153, 29)"},
+)
+move-cursor-to: ".impl-items .rightside .srclink"
+assert-css: (
+    ".impl-items .rightside .srclink",
+    {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
+)
+move-cursor-to: ".impl-items .rightside.srclink"
+assert-css: (
+    ".impl-items .rightside.srclink",
+    {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
+)
+
+goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
+
+assert-css: ("#top-doc-prose-title", {"color": "rgb(221, 221, 221)"})
+
+assert-css: (".sidebar a", {"color": "rgb(253, 191, 53)"})
+assert-css: (".in-band a", {"color": "rgb(221, 221, 221)"})
+
+// We move the cursor over the "Implementations" title so the anchor is displayed.
+move-cursor-to: "h2#implementations"
+assert-css: ("h2#implementations a.anchor", {"color": "rgb(221, 221, 221)"})
+
+// Same thing with the impl block title.
+move-cursor-to: "#impl-HeavilyDocumentedStruct"
+assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": "rgb(221, 221, 221)"})
+
+assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
+
+//
+// We do the same checks with the ayu theme now.
+//
+local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
+goto: file://|DOC_PATH|/staged_api/struct.Foo.html
+
+assert-css: ("#toggle-all-docs", {"color": "rgb(197, 197, 197)"})
+assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(255, 255, 255)"})
+assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(255, 160, 165)"})
+assert-css: (
+    ".rightside .srclink",
+    {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
+    ALL,
+)
+compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
+compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])
+
+move-cursor-to: ".main-heading .srclink"
+assert-css: (
+    ".main-heading .srclink",
+    {"color": "rgb(57, 175, 215)", "text-decoration": "underline solid rgb(57, 175, 215)"},
+)
+move-cursor-to: ".impl-items .rightside .srclink"
+assert-css: (
+    ".impl-items .rightside .srclink",
+    {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
+)
+move-cursor-to: ".impl-items .rightside.srclink"
+assert-css: (
+    ".impl-items .rightside.srclink",
+    {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
+)
+
+goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
+
+assert-css: ("#top-doc-prose-title", {"color": "rgb(255, 255, 255)"})
+
+assert-css: (".sidebar a", {"color": "rgb(83, 177, 219)"})
+assert-css: (".in-band a", {"color": "rgb(255, 255, 255)"})
+
+// We move the cursor over the "Implementations" title so the anchor is displayed.
+move-cursor-to: "h2#implementations"
+assert-css: ("h2#implementations a.anchor", {"color": "rgb(197, 197, 197)"})
+
+// Same thing with the impl block title.
+move-cursor-to: "#impl-HeavilyDocumentedStruct"
+assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": "rgb(197, 197, 197)"})
+
+assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
index 8c2c3df1588f507370b1c20f0a1fbafa35abbeb2..ed07e777b1880991054783102d85f78ae585c842 100644 (file)
@@ -247,12 +247,12 @@ assert-css: (
 
 local-storage: {"rustdoc-theme": "light"}
 goto: file://|DOC_PATH|/staged_api/struct.Foo.html
-assert-css: (".since", {"color": "rgb(128, 128, 128)"})
+assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
 
 local-storage: {"rustdoc-theme": "dark"}
 reload:
-assert-css: (".since", {"color": "rgb(128, 128, 128)"})
+assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
 
 local-storage: {"rustdoc-theme": "ayu"}
 reload:
-assert-css: (".since", {"color": "rgb(128, 128, 128)"})
+assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
index 117c4134e34199a9942da1a3ede039768a99fecf..b231be6eee902f049ccc85f1d5379b8b84272c30 100644 (file)
@@ -7,5 +7,6 @@ edition = "2021"
 path = "lib.rs"
 
 [features]
-default = ["some_feature"]
+default = ["some_feature", "some_other_feature"]
 some_feature = []
+some_other_feature = []
index 0cb460f03f701b25bd4463adbea5f10cde333ff2..5934593a8999b94c6e711a41d8e14b2573dd17af 100644 (file)
@@ -7,4 +7,6 @@ pub struct Foo {}
 impl Foo {
     #[stable(feature = "some_feature", since = "1.3.5")]
     pub fn bar() {}
+    #[stable(feature = "some_other_feature", since = "1.3.6")]
+    pub fn yo() {}
 }
index 98f47e53038a99a0918f1b3b6ee2199930ea0c52..4da1ffead2a4c61a39971d02496f74c38827e07a 100644 (file)
@@ -1 +1 @@
-<div id="associatedconstant.YOLO" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#16">source</a></div><h4 class="code-header">const <a href="#associatedconstant.YOLO" class="constant">YOLO</a>: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></div>
+<div id="associatedconstant.YOLO" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#16">source</a><h4 class="code-header">const <a href="#associatedconstant.YOLO" class="constant">YOLO</a>: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></div>
\ No newline at end of file
index 6d37e8e5eee5e1cd0b79a2f15728b3b3dce724d0..c002519760242a4ce4d216f3918c1735d8e725cd 100644 (file)
@@ -1 +1 @@
-<section id="associatedconstant.X" class="associatedconstant has-srclink"><span class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#42">source</a></span><h4 class="code-header">pub const <a href="#associatedconstant.X" class="constant">X</a>: <a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a> = 0i32</h4></section>
+<section id="associatedconstant.X" class="associatedconstant has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#42">source</a><h4 class="code-header">pub const <a href="#associatedconstant.X" class="constant">X</a>: <a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a> = 0i32</h4></section>
\ No newline at end of file
index f46d3090ed37054ec5bbd86c69d510747f28f22d..521fdcb7877a707c061af17dbc5ac9b52c9253e6 100644 (file)
@@ -1 +1 @@
-<section id="method.new" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#48">source</a></span><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>() -&gt; Self</h4></section>
\ No newline at end of file
+<section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#48">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>() -&gt; Self</h4></section>
\ No newline at end of file
index 445a7bb560acaf4baeb3a66a59603dc9bb1973d8..6b78c7c811a068caeb9f993bac0282411fcabe97 100644 (file)
@@ -1 +1 @@
-<div id="method.bar" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#23">source</a></div><h4 class="code-header">fn <a href="#method.bar" class="fnname">bar</a>()</h4></div>
\ No newline at end of file
+<div id="method.bar" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#23">source</a><h4 class="code-header">fn <a href="#method.bar" class="fnname">bar</a>()</h4></div>
\ No newline at end of file
index bb0771b10035dfe3867003cf49b5223f179ce690..c08f4427cf697309c56499ed992eeef9b0d2c193 100644 (file)
@@ -1 +1 @@
-<div id="tymethod.foo" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#20">source</a></div><h4 class="code-header">fn <a href="#tymethod.foo" class="fnname">foo</a>()</h4></div>
\ No newline at end of file
+<div id="tymethod.foo" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#20">source</a><h4 class="code-header">fn <a href="#tymethod.foo" class="fnname">foo</a>()</h4></div>
\ No newline at end of file
index d317eb5005017cb26f81b556d01236a02c83e8d4..ba8e65443ec8132241f4d098a5c728ad7ab7663f 100644 (file)
@@ -1 +1 @@
-<div id="associatedtype.T" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#13">source</a></div><h4 class="code-header">type <a href="#associatedtype.T" class="associatedtype">T</a></h4></div>
\ No newline at end of file
+<div id="associatedtype.T" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#13">source</a><h4 class="code-header">type <a href="#associatedtype.T" class="associatedtype">T</a></h4></div>
\ No newline at end of file
index 9f8b0277e76b0a7c8dd2329ae3a687332a3c6e38..c65387080f11b3f34611cca9a4c171135e6a9590 100644 (file)
@@ -2,5 +2,5 @@
 
 // This test ensures that the [src] link is present on traits items.
 
-// @has foo/trait.Iterator.html '//*[@id="method.zip"]//a[@class="srclink"]' "source"
+// @has foo/trait.Iterator.html '//*[@id="method.zip"]//a[@class="srclink rightside"]' "source"
 pub use std::iter::Iterator;
index 69be9aa8d5f1011213f24589337f844b86647f2b..313a4b1189334c7f04bf4f2477907fb2d55aba89 100644 (file)
@@ -6,7 +6,7 @@
 // @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header in-band"]' 'impl Sync for Unsized'
 // @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="srclink"]' 'source'
 // @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header in-band"]' 'impl<T> Any for T'
-// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="srclink"]' 'source'
+// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="srclink rightside"]' 'source'
 pub struct Unsized {
     data: [u8],
 }
index ae866deba1ef039e488b75b5863f4d8a8e4d5b8e..04ea46a7f3a01a3cfbf85dc7e9ba7a41794bce0c 100644 (file)
@@ -16,7 +16,7 @@ pub fn foo() {}
 pub struct Bar;
 
 impl Bar {
-    // @has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0'
+    // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0'
     // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·'
     #[stable(feature = "foobar", since = "2.0")]
     pub fn bar() {}