Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0b269f3
add kernel target for RustyHermit
stlankes Jan 8, 2022
10ae04a
add missing description of the target aarch64-unknown-none-hermitkernel
stlankes Feb 6, 2022
9225df3
remove typos
stlankes Feb 7, 2022
1acf739
add missing link
stlankes Feb 7, 2022
c7f65ae
remove typo
stlankes Feb 7, 2022
beb042a
add missing targert for library operating system RustyHermit
stlankes Feb 7, 2022
b5c1dc0
rename file to use the correct naming convention
stlankes Feb 7, 2022
df70adf
add missing space
stlankes Feb 8, 2022
6aad08f
Unify headings indent and remove useless anchor
GuillaumeGomez Feb 9, 2022
e8d5ae4
Update rustdoc tests for headings indent
GuillaumeGomez Feb 9, 2022
49d4823
Stabilize cfg_target_has_atomic
Amanieu Feb 9, 2022
fa400ac
rustdoc: Create enum for sections holding items
camelid Jan 8, 2022
1115f69
Deduplicate item sections
camelid Jan 8, 2022
163a800
Refactor sidebar printing code
camelid Jan 8, 2022
504f3f0
Title-case trait aliases section for consistency
camelid Jan 7, 2022
69cd826
Add llvm.build-config option
tmandry Feb 8, 2022
bdc9508
kmc-solid: Fix wait queue manipulation errors in the `Condvar` implem…
kawadakk Feb 9, 2022
1d180ca
kmc-solid: Wait queue should be sorted in the descending order of tas…
kawadakk Feb 10, 2022
76c562f
fix min_const_generics oversight
lcnr Feb 9, 2022
03332b0
Rollup merge of #92670 - hermitcore:kernel, r=davidtwco
matthiaskrgr Feb 10, 2022
584948d
Rollup merge of #93756 - tmandry:llvm-build-config, r=Mark-Simulacrum
matthiaskrgr Feb 10, 2022
f3f41d7
Rollup merge of #93802 - lcnr:mcg-woops, r=BoxyUwU
matthiaskrgr Feb 10, 2022
2997ea3
Rollup merge of #93808 - GuillaumeGomez:headings-indent, r=jsha
matthiaskrgr Feb 10, 2022
aa20959
Rollup merge of #93824 - Amanieu:stable_cfg_target_has_atomic, r=davi…
matthiaskrgr Feb 10, 2022
4256165
Rollup merge of #93830 - camelid:cleanup-section-code, r=GuillaumeGomez
matthiaskrgr Feb 10, 2022
8c60f44
Rollup merge of #93843 - solid-rs:fix-kmc-solid-condvar, r=m-ou-se
matthiaskrgr Feb 10, 2022
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
2 changes: 1 addition & 1 deletion src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ impl<'a, 'b, 'ids, I: Iterator<Item = SpannedEvent<'a>>> Iterator
self.buf.push_back((Event::Html(format!("</a></h{}>", level).into()), 0..0));

let start_tags = format!(
"<h{level} id=\"{id}\" class=\"section-header\">\
"<h{level} id=\"{id}\">\
<a href=\"#{id}\">",
id = id,
level = level
Expand Down
47 changes: 10 additions & 37 deletions src/librustdoc/html/markdown/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,22 @@ fn test_header() {
assert_eq!(output, expect, "original: {}", input);
}

t(
"# Foo bar",
"<h2 id=\"foo-bar\" class=\"section-header\"><a href=\"#foo-bar\">Foo bar</a></h2>",
);
t("# Foo bar", "<h2 id=\"foo-bar\"><a href=\"#foo-bar\">Foo bar</a></h2>");
t(
"## Foo-bar_baz qux",
"<h3 id=\"foo-bar_baz-qux\" class=\"section-header\">\
"<h3 id=\"foo-bar_baz-qux\">\
<a href=\"#foo-bar_baz-qux\">Foo-bar_baz qux</a></h3>",
);
t(
"### **Foo** *bar* baz!?!& -_qux_-%",
"<h4 id=\"foo-bar-baz--qux-\" class=\"section-header\">\
"<h4 id=\"foo-bar-baz--qux-\">\
<a href=\"#foo-bar-baz--qux-\"><strong>Foo</strong> \
<em>bar</em> baz!?!&amp; -<em>qux</em>-%</a>\
</h4>",
);
t(
"#### **Foo?** & \\*bar?!* _`baz`_ ❤ #qux",
"<h5 id=\"foo--bar--baz--qux\" class=\"section-header\">\
"<h5 id=\"foo--bar--baz--qux\">\
<a href=\"#foo--bar--baz--qux\"><strong>Foo?</strong> &amp; *bar?!* \
<em><code>baz</code></em> ❤ #qux</a>\
</h5>",
Expand All @@ -201,36 +198,12 @@ fn test_header_ids_multiple_blocks() {
assert_eq!(output, expect, "original: {}", input);
}

t(
&mut map,
"# Example",
"<h2 id=\"example\" class=\"section-header\"><a href=\"#example\">Example</a></h2>",
);
t(
&mut map,
"# Panics",
"<h2 id=\"panics\" class=\"section-header\"><a href=\"#panics\">Panics</a></h2>",
);
t(
&mut map,
"# Example",
"<h2 id=\"example-1\" class=\"section-header\"><a href=\"#example-1\">Example</a></h2>",
);
t(
&mut map,
"# Search",
"<h2 id=\"search-1\" class=\"section-header\"><a href=\"#search-1\">Search</a></h2>",
);
t(
&mut map,
"# Example",
"<h2 id=\"example-2\" class=\"section-header\"><a href=\"#example-2\">Example</a></h2>",
);
t(
&mut map,
"# Panics",
"<h2 id=\"panics-1\" class=\"section-header\"><a href=\"#panics-1\">Panics</a></h2>",
);
t(&mut map, "# Example", "<h2 id=\"example\"><a href=\"#example\">Example</a></h2>");
t(&mut map, "# Panics", "<h2 id=\"panics\"><a href=\"#panics\">Panics</a></h2>");
t(&mut map, "# Example", "<h2 id=\"example-1\"><a href=\"#example-1\">Example</a></h2>");
t(&mut map, "# Search", "<h2 id=\"search-1\"><a href=\"#search-1\">Search</a></h2>");
t(&mut map, "# Example", "<h2 id=\"example-2\"><a href=\"#example-2\">Example</a></h2>");
t(&mut map, "# Panics", "<h2 id=\"panics-1\"><a href=\"#panics-1\">Panics</a></h2>");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2567,7 +2567,7 @@ fn render_call_locations(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item) {
w,
"<div class=\"docblock scraped-example-list\">\
<span></span>\
<h5 id=\"{id}\" class=\"section-header\">\
<h5 id=\"{id}\">\
<a href=\"#{id}\">Examples found in repository</a>\
</h5>",
id = id
Expand Down
21 changes: 0 additions & 21 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -1141,16 +1141,6 @@ a.test-arrow {
a.test-arrow:hover{
text-decoration: none;
}
.section-header:hover a:before {
position: absolute;
left: -25px;
padding-right: 10px; /* avoid gap that causes hover to disappear */
content: '\2002\00a7\2002';
}

.section-header:hover a {
text-decoration: none;
}

.code-attribute {
font-weight: 300;
Expand Down Expand Up @@ -1196,17 +1186,6 @@ h3.variant {
margin-top: 3px;
}

.top-doc .docblock > .section-header:first-child {
margin-left: 15px;
}
.top-doc .docblock > .section-header:first-child:hover > a:before {
left: -10px;
}

.docblock > .section-header:first-child {
margin-top: 0;
}

:target > code, :target > .code-header {
opacity: 1;
}
Expand Down
42 changes: 0 additions & 42 deletions src/test/rustdoc-gui/anchors.goml
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +31,4 @@ assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"})
move-cursor-to: "#impl"
assert-css: ("#impl a.anchor", {"color": "rgb(0, 0, 0)"})

// Now we check the positions: only the first heading of the top doc comment should
// have a different position.
move-cursor-to: ".top-doc .docblock .section-header:first-child"
assert-css: (
".top-doc .docblock .section-header:first-child > a::before",
{"left": "-10px", "padding-right": "10px"},
)
// We also check that the heading itself has a different indent.
assert-css: (".top-doc .docblock .section-header:first-child", {"margin-left": "15px"})

move-cursor-to: ".top-doc .docblock .section-header:not(:first-child)"
assert-css: (
".top-doc .docblock .section-header:not(:first-child) > a::before",
{"left": "-25px", "padding-right": "10px"},
)
assert-css: (".top-doc .docblock .section-header:not(:first-child)", {"margin-left": "0px"})

// Now let's check some other docblock headings...
// First the impl block docs.
move-cursor-to: "#title-for-struct-impl-doc"
assert-css: (
"#title-for-struct-impl-doc > a::before",
{"left": "-25px", "padding-right": "10px"},
)
assert-css: ("#title-for-struct-impl-doc", {"margin-left": "0px"})
// Now a method docs.
move-cursor-to: "#title-for-struct-impl-item-doc"
assert-css: (
"#title-for-struct-impl-item-doc > a::before",
{"left": "-25px", "padding-right": "10px"},
)
assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})

// Finally, we want to ensure that if the first element of the doc block isn't a heading,
// if there is a heading afterwards, it won't have the indent.
goto: file://|DOC_PATH|/test_docs/enum.WhoLetTheDogOut.html

move-cursor-to: ".top-doc .docblock .section-header"
assert-css: (
".top-doc .docblock .section-header > a::before",
{"left": "-25px", "padding-right": "10px"},
)
assert-css: (".top-doc .docblock .section-header", {"margin-left": "0px"})
9 changes: 6 additions & 3 deletions src/test/rustdoc-gui/headers-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL)

goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
assert-css: (".section-header a", {"color": "rgb(57, 175, 215)"}, ALL)
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": "rgb(57, 175, 215)"}, ALL)

// Dark theme
local-storage: {
Expand Down Expand Up @@ -78,7 +79,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL)

goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
assert-css: (".section-header a", {"color": "rgb(210, 153, 29)"}, ALL)
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL)

// Light theme
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
Expand Down Expand Up @@ -111,4 +113,5 @@ goto: file://|DOC_PATH|/test_docs/index.html
assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL)

goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
assert-css: (".section-header a", {"color": "rgb(56, 115, 173)"}, ALL)
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": "rgb(56, 115, 173)"}, ALL)