diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index ae0e3572a08c6..21f8aaa3a9e9c 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -778,14 +778,6 @@ pre, .rustdoc.source .example-wrap { margin-bottom: .6em; } -.content .impl-items > .item-info { - margin-left: 40px; -} - -.methods > .item-info, .content .impl-items > .item-info { - margin-top: -8px; -} - .impl-items { flex-basis: 100%; } @@ -2009,6 +2001,11 @@ in storage.js plus the media query with (min-width: 701px) #main-content > div > details.rustdoc-toggle > summary::before { left: -11px; } + + /* Align summary-nested and unnested item-info gizmos. */ + .content .impl-items > .item-info { + margin-left: 34px; + } } @media print { diff --git a/src/test/rustdoc-gui/item-info-alignment.goml b/src/test/rustdoc-gui/item-info-alignment.goml new file mode 100644 index 0000000000000..4d7b5045f7c15 --- /dev/null +++ b/src/test/rustdoc-gui/item-info-alignment.goml @@ -0,0 +1,10 @@ +// This test ensures that the "item-info" looks about the same +// whether or not it's inside a toggle. +goto: file://|DOC_PATH|/lib2/struct.ItemInfoAlignmentTest.html + +// First, we try it in "desktop" mode. +size: (1200, 870) +compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x")) +// Next, we try it in "mobile" mode (max-width: 700px). +size: (650, 650) +compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x")) diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs index 7f3172878bfb5..5a151ed7b687a 100644 --- a/src/test/rustdoc-gui/src/lib2/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/lib.rs @@ -170,3 +170,13 @@ where type Output; fn index(&self, index: Idx) -> &Self::Output; } + +pub struct ItemInfoAlignmentTest; + +impl ItemInfoAlignmentTest { + /// This method has docs + #[deprecated] + pub fn foo() {} + #[deprecated] + pub fn bar() {} +}