This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +56
-4
lines changed
src/librustdoc/html/static/css Expand file tree Collapse file tree 4 files changed +56
-4
lines changed Original file line number Diff line number Diff line change @@ -2166,7 +2166,8 @@ details.toggle > summary:not(.hideme)::before {
21662166 top : 4px ;
21672167}
21682168
2169- .impl-items > details .toggle > summary : not (.hideme )::before {
2169+ .impl-items > details .toggle > summary : not (.hideme )::before ,
2170+ # main-content > .methods > details .toggle > summary : not (.hideme )::before {
21702171 position : absolute;
21712172 left : -24px ;
21722173}
@@ -2176,7 +2177,9 @@ details.toggle > summary:not(.hideme)::before {
21762177.impl-items > * : not (.item-info ),
21772178/* We also indent the first top doc comment the same to still keep an indent on the
21782179 doc block while aligning it with the impl block items. */
2179- .implementors-toggle > .docblock {
2180+ .implementors-toggle > .docblock ,
2181+ /* We indent trait items as well. */
2182+ # main-content > .methods > : not (.item-info ) {
21802183 margin-left : var (--impl-items-indent );
21812184}
21822185
@@ -2508,7 +2511,8 @@ in src-script.js and main.js
25082511 margin-left : 10px ;
25092512 }
25102513
2511- .impl-items > details .toggle > summary : not (.hideme )::before {
2514+ .impl-items > details .toggle > summary : not (.hideme )::before ,
2515+ # main-content > .methods > details .toggle > summary : not (.hideme )::before {
25122516 left : -20px ;
25132517 }
25142518
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ call-function: ("check-colors", {
7878set-window-size: (851, 600)
7979
8080// Check the size and count in tabs
81- assert-text: ("#search-tabs > button:nth-child(1) > .count", " (26 ) ")
81+ assert-text: ("#search-tabs > button:nth-child(1) > .count", " (27 ) ")
8282assert-text: ("#search-tabs > button:nth-child(2) > .count", " (7) ")
8383assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0) ")
8484store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
Original file line number Diff line number Diff line change @@ -691,3 +691,25 @@ impl ImplDoc {
691691impl ImplDoc {
692692 pub fn bar5 ( ) { }
693693}
694+
695+ pub trait ItemsTrait {
696+ /// You want doc, here is doc!
697+ ///
698+ /// blablala
699+ type F ;
700+
701+ /// You want doc, here is doc!
702+ ///
703+ /// blablala
704+ const X : u32 ;
705+
706+ /// You want doc, here is doc!
707+ ///
708+ /// blablala
709+ fn foo ( ) { }
710+
711+ /// You want doc, here is doc!
712+ ///
713+ /// blablala
714+ fn bar ( ) ;
715+ }
Original file line number Diff line number Diff line change @@ -31,3 +31,29 @@ assert-attribute: (".top-doc", {"open": ""})
3131// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
3232click: (3, 270)
3333assert-attribute: (".top-doc", {"open": ""})
34+
35+ // Same check on trait items.
36+ fail-on-request-error: false // To prevent downloads errors on "trait.impl/test_docs/trait.ItemsTrait.js"
37+ go-to: "file://" + |DOC_PATH| + "/test_docs/trait.ItemsTrait.html"
38+
39+ define-function: (
40+ "check-trait-item",
41+ [nth, text],
42+ block {
43+ store-value: (selector, ".methods:nth-of-type(" + |nth| + ") > details summary")
44+ assert-text: (|selector| + " h4", |text|)
45+ assert-position: (
46+ |selector| + "::before",
47+ {"x": 6},
48+ )
49+ },
50+ )
51+
52+ // Assert the position of the toggle on an associated const.
53+ call-function: ("check-trait-item", {"nth": 2, "text": "const X: u32"})
54+ // Assert the position of the toggle on an associated type.
55+ call-function: ("check-trait-item", {"nth": 3, "text": "type F"})
56+ // Assert the position of the toggle on an associated required method.
57+ call-function: ("check-trait-item", {"nth": 4, "text": "fn bar()"})
58+ // Assert the position of the toggle on an associated provided method.
59+ call-function: ("check-trait-item", {"nth": 5, "text": "fn foo()"})
You can’t perform that action at this time.
0 commit comments