diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-07-03 18:46:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-03 18:46:14 +0200 |
| commit | ef21fd57c545bf2fdc69f431d2ff73c841b361f1 (patch) | |
| tree | d06dd3c7d30de688357d1ed90168b86218be834e | |
| parent | 4668d3e737bad1a250500a77ba529d2006f1dd47 (diff) | |
| parent | 9d130582ab00195d4bc07c1cc7bcbcefd46e779c (diff) | |
| download | rust-ef21fd57c545bf2fdc69f431d2ff73c841b361f1.tar.gz rust-ef21fd57c545bf2fdc69f431d2ff73c841b361f1.zip | |
Rollup merge of #113285 - GuillaumeGomez:display-long-inline-cfg, r=notriddle
[rustdoc] Fix display of long inline cfg labels Fixes #87957. Fixes #112880. Before:  After:  r? `@notriddle`
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 6 | ||||
| -rw-r--r-- | tests/rustdoc-gui/label-next-to-symbol.goml | 12 | ||||
| -rw-r--r-- | tests/rustdoc-gui/src/test_docs/lib.rs | 9 |
3 files changed, 23 insertions, 4 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index ccfd4cc5b87..b7f455259ef 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -971,6 +971,8 @@ so that we can apply CSS-filters to change the arrow color in themes */ display: flex; padding: 3px; margin-bottom: 5px; + align-items: center; + vertical-align: text-bottom; } .item-name .stab { margin-left: 0.3125em; @@ -982,11 +984,9 @@ so that we can apply CSS-filters to change the arrow color in themes */ color: var(--main-color); background-color: var(--stab-background-color); width: fit-content; - align-items: center; white-space: pre-wrap; border-radius: 3px; - display: inline-flex; - vertical-align: text-bottom; + display: inline; } .stab.portability > code { diff --git a/tests/rustdoc-gui/label-next-to-symbol.goml b/tests/rustdoc-gui/label-next-to-symbol.goml index 6c6380256bd..eb603d6c6b6 100644 --- a/tests/rustdoc-gui/label-next-to-symbol.goml +++ b/tests/rustdoc-gui/label-next-to-symbol.goml @@ -37,7 +37,6 @@ compare-elements-position: ( ("y"), ) - // Mobile view set-window-size: (600, 600) // staggered layout with 2em spacing @@ -64,3 +63,14 @@ compare-elements-position-false: ( "//*[@class='desc docblock-short'][text()='a thing with a label']", ("y"), ) + +// Ensure it doesn't expand. +set-window-size: (800, 800) +go-to: "file://" + |DOC_PATH| + "/test_docs/cfgs/index.html" +// This part of the tags should not be on the same line as the beginning since the width +// is too small for that. +compare-elements-position-false: ( + "//*[@class='stab portability']/code[text()='appservice-api-c']", + "//*[@class='stab portability']/code[text()='server']", + ("y"), +) diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index c040fa02dff..ecf3a7cc147 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -507,3 +507,12 @@ pub mod fields { }, } } + +pub mod cfgs { + #[doc(cfg(all( + any(not(feature = "appservice-api-c"), not(feature = "appservice-api-s")), + any(not(feature = "client"), not(feature = "server")), + )))] + /// Some docs. + pub mod cfgs {} +} |
