Skip to content

Commit ef21fd5

Browse files
Rollup merge of #113285 - GuillaumeGomez:display-long-inline-cfg, r=notriddle
[rustdoc] Fix display of long inline cfg labels Fixes #87957. Fixes #112880. Before: ![Screenshot from 2023-07-03 13-25-47](https://github.com/rust-lang/rust/assets/3050060/401e2c6b-2cfd-4ae3-9d15-b5e1dfec4201) After: ![Screenshot from 2023-07-03 13-24-49](https://github.com/rust-lang/rust/assets/3050060/e42a34a8-bf60-409d-8a0c-1669d09e7e1e) r? `@notriddle`
2 parents 4668d3e + 9d13058 commit ef21fd5

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

Diff for: src/librustdoc/html/static/css/rustdoc.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,8 @@ so that we can apply CSS-filters to change the arrow color in themes */
971971
display: flex;
972972
padding: 3px;
973973
margin-bottom: 5px;
974+
align-items: center;
975+
vertical-align: text-bottom;
974976
}
975977
.item-name .stab {
976978
margin-left: 0.3125em;
@@ -982,11 +984,9 @@ so that we can apply CSS-filters to change the arrow color in themes */
982984
color: var(--main-color);
983985
background-color: var(--stab-background-color);
984986
width: fit-content;
985-
align-items: center;
986987
white-space: pre-wrap;
987988
border-radius: 3px;
988-
display: inline-flex;
989-
vertical-align: text-bottom;
989+
display: inline;
990990
}
991991

992992
.stab.portability > code {

Diff for: tests/rustdoc-gui/label-next-to-symbol.goml

+11-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ compare-elements-position: (
3737
("y"),
3838
)
3939

40-
4140
// Mobile view
4241
set-window-size: (600, 600)
4342
// staggered layout with 2em spacing
@@ -64,3 +63,14 @@ compare-elements-position-false: (
6463
"//*[@class='desc docblock-short'][text()='a thing with a label']",
6564
("y"),
6665
)
66+
67+
// Ensure it doesn't expand.
68+
set-window-size: (800, 800)
69+
go-to: "file://" + |DOC_PATH| + "/test_docs/cfgs/index.html"
70+
// This part of the tags should not be on the same line as the beginning since the width
71+
// is too small for that.
72+
compare-elements-position-false: (
73+
"//*[@class='stab portability']/code[text()='appservice-api-c']",
74+
"//*[@class='stab portability']/code[text()='server']",
75+
("y"),
76+
)

Diff for: tests/rustdoc-gui/src/test_docs/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -507,3 +507,12 @@ pub mod fields {
507507
},
508508
}
509509
}
510+
511+
pub mod cfgs {
512+
#[doc(cfg(all(
513+
any(not(feature = "appservice-api-c"), not(feature = "appservice-api-s")),
514+
any(not(feature = "client"), not(feature = "server")),
515+
)))]
516+
/// Some docs.
517+
pub mod cfgs {}
518+
}

0 commit comments

Comments
 (0)