diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 399730a01c82f..ce96d1d0a95c2 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2010,9 +2010,9 @@ fn render_rightside(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, render ); if let Some(link) = src_href { if has_stability { - write!(rightside, " · source") + write!(rightside, " · Source") } else { - write!(rightside, "source") + write!(rightside, "Source") } } if has_stability && has_src_ref { diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index df9776ff5f88c..db857745295a5 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -185,7 +185,7 @@ h1, h2, h3, h4 { grid-template-columns: minmax(105px, 1fr) minmax(0, max-content); grid-template-rows: minmax(25px, min-content) min-content min-content; padding-bottom: 6px; - margin-bottom: 11px; + margin-bottom: 15px; } .rustdoc-breadcrumbs { grid-area: main-heading-breadcrumbs; @@ -1004,6 +1004,7 @@ nav.sub { display: flex; height: 34px; flex-grow: 1; + margin-bottom: 4px; } .src nav.sub { margin: 0 0 -10px 0; @@ -2253,7 +2254,12 @@ in src-script.js and main.js /* We don't display this button on mobile devices. */ #copy-path { - display: none; + /* display: none; avoided as a layout hack. + When there's one line, we get an effective line-height of 34px, + because that's how big the image is, but if the header wraps, + they're packed more tightly than that. */ + width: 0; + visibility: hidden; } /* Text label takes up too much space at this size. */ diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html index f60720b67c64c..9fd575b2751e0 100644 --- a/src/librustdoc/html/templates/print_item.html +++ b/src/librustdoc/html/templates/print_item.html @@ -26,7 +26,7 @@
`. click: (163, 77) assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH) @@ -165,7 +165,7 @@ assert-css: ("nav.sub", {"flex-direction": "row"}) // offsetTop[nav.sub form] = offsetTop[#main-content] - offsetHeight[nav.sub form] - offsetTop[nav.sub form] assert-position: ("nav.sub form", {"y": 15}) assert-property: ("nav.sub form", {"offsetHeight": 34}) -assert-position: ("h1", {"y": 64}) +assert-position: ("h1", {"y": 68}) // 15 = 64 - 34 - 15 // Now do the same check on moderately-sized, tablet mobile. @@ -173,7 +173,7 @@ set-window-size: (700, 700) assert-css: ("nav.sub", {"flex-direction": "row"}) assert-position: ("nav.sub form", {"y": 8}) assert-property: ("nav.sub form", {"offsetHeight": 34}) -assert-position: ("h1", {"y": 50}) +assert-position: ("h1", {"y": 54}) // 8 = 50 - 34 - 8 // Check the sidebar directory entries have a marker and spacing (tablet). diff --git a/tests/rustdoc/anchors.no_const_anchor.html b/tests/rustdoc/anchors.no_const_anchor.html index 06673d87406c1..07a7507fa2eaa 100644 --- a/tests/rustdoc/anchors.no_const_anchor.html +++ b/tests/rustdoc/anchors.no_const_anchor.html @@ -1 +1 @@ -source \ No newline at end of file +const YOLO: u32
Source \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_const_anchor2.html b/tests/rustdoc/anchors.no_const_anchor2.html index 73c3d0a807b8e..091dac3e4b261 100644 --- a/tests/rustdoc/anchors.no_const_anchor2.html +++ b/tests/rustdoc/anchors.no_const_anchor2.html @@ -1 +1 @@ -const YOLO: u32
source \ No newline at end of file +pub const X: i32 = 0i32
Source \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_method_anchor.html b/tests/rustdoc/anchors.no_method_anchor.html index e8b61caa1c13a..89f9898624c0a 100644 --- a/tests/rustdoc/anchors.no_method_anchor.html +++ b/tests/rustdoc/anchors.no_method_anchor.html @@ -1 +1 @@ -pub const X: i32 = 0i32
source \ No newline at end of file +pub fn new() -> Self
Source \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_trait_method_anchor.html b/tests/rustdoc/anchors.no_trait_method_anchor.html index abdb17c27dc1e..51656a3e58f42 100644 --- a/tests/rustdoc/anchors.no_trait_method_anchor.html +++ b/tests/rustdoc/anchors.no_trait_method_anchor.html @@ -1 +1 @@ -pub fn new() -> Self
source \ No newline at end of file +fn bar()
Source \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_tymethod_anchor.html b/tests/rustdoc/anchors.no_tymethod_anchor.html index 23f4277c5b52e..49ee624bdbc6d 100644 --- a/tests/rustdoc/anchors.no_tymethod_anchor.html +++ b/tests/rustdoc/anchors.no_tymethod_anchor.html @@ -1 +1 @@ -fn bar()
source \ No newline at end of file +fn foo()
Source \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_type_anchor.html b/tests/rustdoc/anchors.no_type_anchor.html index 62b9295508fbb..c5ac3c93818bf 100644 --- a/tests/rustdoc/anchors.no_type_anchor.html +++ b/tests/rustdoc/anchors.no_type_anchor.html @@ -1 +1 @@ -fn foo()
source \ No newline at end of file +type T
Source \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_type_anchor2.html b/tests/rustdoc/anchors.no_type_anchor2.html index 9127104ded4af..14dd31d87b644 100644 --- a/tests/rustdoc/anchors.no_type_anchor2.html +++ b/tests/rustdoc/anchors.no_type_anchor2.html @@ -1 +1 @@ -type T
source \ No newline at end of file +pub type Y = u32
Source \ No newline at end of file diff --git a/tests/rustdoc/assoc-type-source-link.rs b/tests/rustdoc/assoc-type-source-link.rs index 34b156b964957..a955a67a4579e 100644 --- a/tests/rustdoc/assoc-type-source-link.rs +++ b/tests/rustdoc/assoc-type-source-link.rs @@ -8,7 +8,7 @@ pub struct Bar; impl Bar { - //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a' 'source' + //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a' 'Source' //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a/@href' \ // '../src/foo/assoc-type-source-link.rs.html#14' pub type Y = u8; @@ -19,7 +19,7 @@ pub trait Foo { } impl Foo for Bar { - //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a' 'source' + //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a' 'Source' //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a/@href' \ // '../src/foo/assoc-type-source-link.rs.html#25' type Z = u8; diff --git a/tests/rustdoc/ensure-src-link.rs b/tests/rustdoc/ensure-src-link.rs index 4156fdcba593e..f70902b1756fd 100644 --- a/tests/rustdoc/ensure-src-link.rs +++ b/tests/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 '//*[@id="method.zip"]//a[@class="src"]' "source" +//@ has foo/trait.Iterator.html '//*[@id="method.zip"]//a[@class="src"]' "Source" pub use std::iter::Iterator; diff --git a/tests/rustdoc/external-macro-src.rs b/tests/rustdoc/external-macro-src.rs index f723af57fadb2..998687d93bdc2 100644 --- a/tests/rustdoc/external-macro-src.rs +++ b/tests/rustdoc/external-macro-src.rs @@ -5,8 +5,8 @@ #[macro_use] extern crate external_macro_src; -//@ has foo/index.html '//a[@href="../src/foo/external-macro-src.rs.html#3-12"]' 'source' +//@ has foo/index.html '//a[@href="../src/foo/external-macro-src.rs.html#3-12"]' 'Source' //@ has foo/struct.Foo.html -//@ has - '//a[@href="../src/foo/external-macro-src.rs.html#12"]' 'source' +//@ has - '//a[@href="../src/foo/external-macro-src.rs.html#12"]' 'Source' make_foo!(); diff --git a/tests/rustdoc/source-version-separator.rs b/tests/rustdoc/source-version-separator.rs index 9709bbe3c7181..78b9d364d2152 100644 --- a/tests/rustdoc/source-version-separator.rs +++ b/tests/rustdoc/source-version-separator.rs @@ -3,23 +3,23 @@ #![feature(staged_api)] //@ has foo/trait.Bar.html -//@ has - '//div[@class="main-heading"]/*[@class="sub-heading"]' '1.0.0 · source' +//@ has - '//div[@class="main-heading"]/*[@class="sub-heading"]' '1.0.0 · Source' #[stable(feature = "bar", since = "1.0")] pub trait Bar { - //@ has - '//*[@id="tymethod.foo"]/*[@class="rightside"]' '3.0.0 · source' + //@ has - '//*[@id="tymethod.foo"]/*[@class="rightside"]' '3.0.0 · Source' #[stable(feature = "foobar", since = "3.0")] fn foo(); } -//@ has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0.0 · source' +//@ has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0.0 · Source' //@ has foo/struct.Foo.html -//@ has - '//div[@class="main-heading"]/*[@class="sub-heading"]' '1.0.0 · source' +//@ has - '//div[@class="main-heading"]/*[@class="sub-heading"]' '1.0.0 · Source' #[stable(feature = "baz", since = "1.0")] pub struct Foo; impl Foo { - //@ has - '//*[@id="method.foofoo"]/*[@class="rightside"]' '3.0.0 · source' + //@ has - '//*[@id="method.foofoo"]/*[@class="rightside"]' '3.0.0 · Source' #[stable(feature = "foobar", since = "3.0")] pub fn foofoo() {} } diff --git a/tests/rustdoc/src-link-external-macro-26606.rs b/tests/rustdoc/src-link-external-macro-26606.rs index b5662be9b2d50..0ce829f06f525 100644 --- a/tests/rustdoc/src-link-external-macro-26606.rs +++ b/tests/rustdoc/src-link-external-macro-26606.rs @@ -10,5 +10,5 @@ extern crate issue_26606_macro; //@ has issue_26606/constant.FOO.html -//@ has - '//a[@href="../src/issue_26606/src-link-external-macro-26606.rs.html#14"]' 'source' +//@ has - '//a[@href="../src/issue_26606/src-link-external-macro-26606.rs.html#14"]' 'Source' make_item!(FOO); diff --git a/tests/rustdoc/src-links-auto-impls.rs b/tests/rustdoc/src-links-auto-impls.rs index dd07f85eee7d3..5a777f59b7e50 100644 --- a/tests/rustdoc/src-links-auto-impls.rs +++ b/tests/rustdoc/src-links-auto-impls.rs @@ -2,11 +2,11 @@ //@ has foo/struct.Unsized.html //@ has - '//*[@id="impl-Sized-for-Unsized"]/h3[@class="code-header"]' 'impl !Sized for Unsized' -//@ !has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="src"]' 'source' +//@ !has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="src"]' 'Source' //@ has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header"]' 'impl Sync for Unsized' -//@ !has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="src"]' 'source' +//@ !has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="src"]' 'Source' //@ has - '//*[@id="impl-Any-for-T"]/h3[@class="code-header"]' 'implpub type Y = u32
Any for T' -//@ has - '//*[@id="impl-Any-for-T"]//a[@class="src rightside"]' 'source' +//@ has - '//*[@id="impl-Any-for-T"]//a[@class="src rightside"]' 'Source' pub struct Unsized { data: [u8], } diff --git a/tests/rustdoc/thread-local-src.rs b/tests/rustdoc/thread-local-src.rs index b23a9a48654f6..16509e8514d32 100644 --- a/tests/rustdoc/thread-local-src.rs +++ b/tests/rustdoc/thread-local-src.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -//@ has foo/index.html '//a[@href="../src/foo/thread-local-src.rs.html#1-6"]' 'source' +//@ has foo/index.html '//a[@href="../src/foo/thread-local-src.rs.html#1-6"]' 'Source' -//@ has foo/constant.FOO.html '//a[@href="../src/foo/thread-local-src.rs.html#6"]' 'source' +//@ has foo/constant.FOO.html '//a[@href="../src/foo/thread-local-src.rs.html#6"]' 'Source' thread_local!(pub static FOO: bool = false); diff --git a/tests/rustdoc/trait-src-link.rs b/tests/rustdoc/trait-src-link.rs index 7c3afb7d7d386..7bf883d52da1e 100644 --- a/tests/rustdoc/trait-src-link.rs +++ b/tests/rustdoc/trait-src-link.rs @@ -1,26 +1,26 @@ #![crate_name = "quix"] pub trait Foo { - //@ has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#4"]' 'source' + //@ has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#4"]' 'Source' fn required(); - //@ has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' 'source' + //@ has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' 'Source' fn provided() {} } pub struct Bar; impl Foo for Bar { - //@ has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#14"]' 'source' + //@ has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#14"]' 'Source' fn required() {} - //@ has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' 'source' + //@ has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' 'Source' } pub struct Baz; impl Foo for Baz { - //@ has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#22"]' 'source' + //@ has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#22"]' 'Source' fn required() {} - //@ has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#25"]' 'source' + //@ has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#25"]' 'Source' fn provided() {} }