Skip to content

Commit b87f649

Browse files
committed
Auto merge of rust-lang#119283 - GuillaumeGomez:warning-block-pos, r=notriddle
Fix display of warning block if it is first element of the top doc block It fixes the display of the warning block "i" element in case it is the first element: ![Screenshot from 2023-12-23 11-15-48](https://github.com/rust-lang/rust/assets/3050060/99b6796e-2a09-4053-813e-84288ce76c4c) It now looks like this: ![image](https://github.com/rust-lang/rust/assets/3050060/306b4cf1-3a7d-4681-b0cf-3e721186bfe8) The update for the `browser-ui-test` framework is because it didn't detect correctly pseudo elements if they ended with a digit or a dash. r? `@notriddle`
2 parents 471dcbd + 98b71bf commit b87f649

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.16.10
1+
0.16.11

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

+3
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,9 @@ documentation. */
13671367
font-weight: bold;
13681368
font-size: 1.25rem;
13691369
}
1370+
.top-doc > .docblock >.warning:first-child::before {
1371+
top: 20px;
1372+
}
13701373

13711374
a.test-arrow {
13721375
visibility: hidden;

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

+3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ impl AsRef<str> for Foo {
8585
}
8686
}
8787

88+
/// <div id="doc-warning-0" class="warning">I have warnings!</div>
89+
pub struct WarningStruct;
90+
8891
/// Just a normal enum.
8992
///
9093
/// # title!

Diff for: tests/rustdoc-gui/warning-block.goml

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
33
show-text: true
44

5+
store-value: (default_y_pos, 5)
56
define-function: (
67
"check-warning",
78
(theme, color, border_color),
@@ -16,12 +17,18 @@ define-function: (
1617
"border-left": "2px solid " + |border_color|,
1718
"background-color": "transparent",
1819
})
20+
store-position: ("#doc-warning-1", {"y": warn_div_y})
21+
store-position: ("#doc-warning-1::before", {"y": warn_y})
22+
assert: |warn_y| == |warn_div_y| + |default_y_pos|
1923
assert-css: ("#doc-warning-2", {
2024
"margin-bottom": "0px",
2125
"color": |color|,
2226
"border-left": "2px solid " + |border_color|,
2327
"background-color": "transparent",
2428
})
29+
store-position: ("#doc-warning-2", {"y": warn_div_y})
30+
store-position: ("#doc-warning-2::before", {"y": warn_y})
31+
assert: |warn_y| == |warn_div_y| + |default_y_pos|
2532
},
2633
)
2734

@@ -40,3 +47,9 @@ call-function: ("check-warning", {
4047
"color": "black",
4148
"border_color": "#ff8e00",
4249
})
50+
51+
// We ensure that the warning element in the top doc is not overlaying the "[-]" button.
52+
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WarningStruct.html"
53+
store-position: ("#doc-warning-0", {"y": warn_div_y})
54+
store-position: ("#doc-warning-0::before", {"y": warn_y})
55+
assert: |warn_y| == |warn_div_y| + |default_y_pos| + 15

0 commit comments

Comments
 (0)