Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rustdoc] Fix display of long inline cfg labels #113285

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
12 changes: 11 additions & 1 deletion tests/rustdoc-gui/label-next-to-symbol.goml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ compare-elements-position: (
("y"),
)


// Mobile view
set-window-size: (600, 600)
// staggered layout with 2em spacing
Expand All @@ -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"),
)
9 changes: 9 additions & 0 deletions tests/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
}