Skip to content

16 files changed

+45
-63
lines changed

src/librustdoc/html/render/context.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
634634
write!(
635635
buf,
636636
"<div class=\"main-heading\">\
637-
<h1 class=\"fqn\">\
638-
<span class=\"in-band\">Rustdoc settings</span>\
639-
</h1>\
637+
<h1 class=\"fqn\">Rustdoc settings</h1>\
640638
<span class=\"out-of-band\">\
641639
<a id=\"back\" href=\"javascript:void(0)\" onclick=\"history.back();\">\
642640
Back\

src/librustdoc/html/render/mod.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,7 @@ impl AllTypes {
364364
}
365365
}
366366

367-
f.write_str(
368-
"<h1 class=\"fqn\">\
369-
<span class=\"in-band\">List of all items</span>\
370-
</h1>",
371-
);
367+
f.write_str("<h1 class=\"fqn\">List of all items</h1>");
372368
// Note: print_entries does not escape the title, because we know the current set of titles
373369
// doesn't require escaping.
374370
print_entries(f, &self.structs, ItemSection::Structs);
@@ -398,9 +394,7 @@ fn scrape_examples_help(shared: &SharedContext<'_>) -> String {
398394
let mut ids = IdMap::default();
399395
format!(
400396
"<div class=\"main-heading\">\
401-
<h1 class=\"fqn\">\
402-
<span class=\"in-band\">About scraped examples</span>\
403-
</h1>\
397+
<h1 class=\"fqn\">About scraped examples</h1>\
404398
</div>\
405399
<div>{}</div>",
406400
Markdown {

src/librustdoc/html/render/write_shared.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,7 @@ if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
517517
};
518518

519519
let content = format!(
520-
"<h1 class=\"fqn\">\
521-
<span class=\"in-band\">List of all crates</span>\
522-
</h1><ul class=\"all-items\">{}</ul>",
520+
"<h1 class=\"fqn\">List of all crates</h1><ul class=\"all-items\">{}</ul>",
523521
krates
524522
.iter()
525523
.map(|s| {

src/librustdoc/html/static/css/rustdoc.css

+9-15
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ h1, h2, h3, h4 {
148148
h1.fqn {
149149
margin: 0;
150150
padding: 0;
151+
flex-grow: 1;
152+
/* We use overflow-wrap: break-word for Safari, which doesn't recognize
153+
`anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
154+
overflow-wrap: break-word;
155+
/* Then override it with `anywhere`, which is required to make non-Safari browsers break
156+
more aggressively when we want them to. */
157+
overflow-wrap: anywhere;
151158
}
152159
.main-heading {
153160
display: flex;
@@ -214,7 +221,7 @@ pre.rust a,
214221
.sidebar h2 a,
215222
.sidebar h3 a,
216223
.mobile-topbar h2 a,
217-
.in-band a,
224+
h1.fqn a,
218225
.search-results a,
219226
.module-item .stab,
220227
.import-item .stab,
@@ -654,19 +661,6 @@ pre.example-line-numbers {
654661
font-weight: normal;
655662
}
656663

657-
.in-band {
658-
flex-grow: 1;
659-
margin: 0px;
660-
padding: 0px;
661-
/* We use overflow-wrap: break-word for Safari, which doesn't recognize
662-
`anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
663-
overflow-wrap: break-word;
664-
/* Then override it with `anywhere`, which is required to make non-Safari browsers break
665-
more aggressively when we want them to. */
666-
overflow-wrap: anywhere;
667-
background-color: var(--main-background-color);
668-
}
669-
670664
.docblock code, .docblock-short code,
671665
pre, .rustdoc.source .example-wrap {
672666
background-color: var(--code-block-background-color);
@@ -752,7 +746,7 @@ a {
752746
display: initial;
753747
}
754748

755-
.in-band:hover > .anchor, .impl:hover > .anchor, .method.trait-impl:hover > .anchor,
749+
.impl:hover > .anchor, .method.trait-impl:hover > .anchor,
756750
.type.trait-impl:hover > .anchor, .associatedconstant.trait-impl:hover > .anchor,
757751
.associatedtype.trait-impl:hover > .anchor {
758752
display: inline-block;

src/librustdoc/html/static/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ function loadCss(cssFileName) {
522522
}
523523

524524
let currentNbImpls = implementors.getElementsByClassName("impl").length;
525-
const traitName = document.querySelector("h1.fqn > .in-band > .trait").textContent;
525+
const traitName = document.querySelector("h1.fqn > .trait").textContent;
526526
const baseIdName = "impl-" + traitName + "-";
527527
const libs = Object.getOwnPropertyNames(imp);
528528
// We don't want to include impls from this JS file, when the HTML already has them.

src/librustdoc/html/templates/print_item.html

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<div class="main-heading"> {#- -#}
22
<h1 class="fqn"> {#- -#}
3-
<span class="in-band"> {#- -#}
4-
{{-typ-}}
5-
{#- The breadcrumbs of the item path, like std::string -#}
6-
{%- for component in path_components -%}
7-
<a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr>
8-
{%- endfor -%}
9-
<a class="{{item_type}}" href="#">{{name}}</a> {#- -#}
10-
<button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"> {#- -#}
11-
<img src="{{static_root_path|safe}}clipboard{{page.resource_suffix}}.svg" {# -#}
12-
width="19" height="18" {# -#}
13-
alt="Copy item path"> {#- -#}
14-
</button> {#- -#}
15-
</span> {#- -#}
3+
{{-typ-}}
4+
{#- The breadcrumbs of the item path, like std::string -#}
5+
{%- for component in path_components -%}
6+
<a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr>
7+
{%- endfor -%}
8+
<a class="{{item_type}}" href="#">{{name}}</a> {#- -#}
9+
<button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"> {#- -#}
10+
<img src="{{static_root_path|safe}}clipboard{{page.resource_suffix}}.svg" {# -#}
11+
width="19" height="18" {# -#}
12+
alt="Copy item path"> {#- -#}
13+
</button> {#- -#}
1614
</h1> {#- -#}
1715
<span class="out-of-band"> {#- -#}
1816
{% if !stability_since_raw.is_empty() %}

src/test/rustdoc-gui/anchors.goml

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
1010
reload:
1111

1212
assert-css: ("#toggle-all-docs", {"color": "rgb(0, 0, 0)"})
13-
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
14-
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 55, 138)"})
13+
assert-css: (".fqn a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
14+
assert-css: (".fqn a:nth-of-type(2)", {"color": "rgb(173, 55, 138)"})
1515
assert-css: (
1616
".rightside .srclink",
1717
{"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
@@ -41,7 +41,7 @@ goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
4141
assert-css: ("#top-doc-prose-title", {"color": "rgb(0, 0, 0)"})
4242

4343
assert-css: (".sidebar a", {"color": "rgb(53, 109, 164)"})
44-
assert-css: (".in-band a", {"color": "rgb(0, 0, 0)"})
44+
assert-css: ("h1.fqn a", {"color": "rgb(0, 0, 0)"})
4545

4646
// We move the cursor over the "Implementations" title so the anchor is displayed.
4747
move-cursor-to: "h2#implementations"
@@ -60,8 +60,8 @@ local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
6060
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
6161

6262
assert-css: ("#toggle-all-docs", {"color": "rgb(221, 221, 221)"})
63-
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(221, 221, 221)"})
64-
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(45, 191, 184)"})
63+
assert-css: (".fqn a:nth-of-type(1)", {"color": "rgb(221, 221, 221)"})
64+
assert-css: (".fqn a:nth-of-type(2)", {"color": "rgb(45, 191, 184)"})
6565
assert-css: (
6666
".rightside .srclink",
6767
{"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
@@ -91,7 +91,7 @@ goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
9191
assert-css: ("#top-doc-prose-title", {"color": "rgb(221, 221, 221)"})
9292

9393
assert-css: (".sidebar a", {"color": "rgb(253, 191, 53)"})
94-
assert-css: (".in-band a", {"color": "rgb(221, 221, 221)"})
94+
assert-css: ("h1.fqn a", {"color": "rgb(221, 221, 221)"})
9595

9696
// We move the cursor over the "Implementations" title so the anchor is displayed.
9797
move-cursor-to: "h2#implementations"
@@ -110,8 +110,8 @@ local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
110110
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
111111

112112
assert-css: ("#toggle-all-docs", {"color": "rgb(197, 197, 197)"})
113-
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(255, 255, 255)"})
114-
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(255, 160, 165)"})
113+
assert-css: (".fqn a:nth-of-type(1)", {"color": "rgb(255, 255, 255)"})
114+
assert-css: (".fqn a:nth-of-type(2)", {"color": "rgb(255, 160, 165)"})
115115
assert-css: (
116116
".rightside .srclink",
117117
{"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
@@ -141,7 +141,7 @@ goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
141141
assert-css: ("#top-doc-prose-title", {"color": "rgb(255, 255, 255)"})
142142

143143
assert-css: (".sidebar a", {"color": "rgb(83, 177, 219)"})
144-
assert-css: (".in-band a", {"color": "rgb(255, 255, 255)"})
144+
assert-css: ("h1.fqn a", {"color": "rgb(255, 255, 255)"})
145145

146146
// We move the cursor over the "Implementations" title so the anchor is displayed.
147147
move-cursor-to: "h2#implementations"

src/test/rustdoc-gui/search-result-go-to-first.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
// First, we check that the first page doesn't have the string we're looking for to ensure
44
// that the feature is changing page as expected.
55
goto: file://|DOC_PATH|/test_docs/index.html
6-
assert-text-false: (".fqn .in-band", "Struct test_docs::Foo")
6+
assert-text-false: (".fqn", "Struct test_docs::Foo")
77

88
// We now check that we land on the search result page if "go_to_first" isn't set.
99
goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo
1010
// Waiting for the search results to appear...
1111
wait-for: "#titles"
12-
assert-text-false: (".fqn .in-band", "Struct test_docs::Foo")
12+
assert-text-false: (".fqn", "Struct test_docs::Foo")
1313
// Ensure that the search results are displayed, not the "normal" content.
1414
assert-css: ("#main-content", {"display": "none"})
1515

1616
// Now we can check that the feature is working as expected!
1717
goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo&go_to_first=true
1818
// Waiting for the page to load...
19-
wait-for-text: (".fqn .in-band", "Struct test_docs::Foo")
19+
wait-for-text: (".fqn", "Struct test_docs::Foo")

src/test/rustdoc-gui/toggle-click-deadspace.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ assert-attribute-false: (".impl-items .rustdoc-toggle", {"open": ""})
1212

1313
// Click the "Trait" part of "impl Trait" and verify it navigates.
1414
click: "#impl-Trait-for-Foo h3 a:first-of-type"
15-
assert-text: (".fqn .in-band", "Trait lib2::Trait")
15+
assert-text: (".fqn", "Trait lib2::Trait")

src/test/rustdoc/index-page.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![crate_name = "foo"]
66

77
// @has foo/../index.html
8-
// @has - '//span[@class="in-band"]' 'List of all crates'
8+
// @has - '//h1[@class="fqn"]' 'List of all crates'
99
// @has - '//ul[@class="all-items"]//a[@href="foo/index.html"]' 'foo'
1010
// @has - '//ul[@class="all-items"]//a[@href="all_item_types/index.html"]' 'all_item_types'
1111
pub struct Foo;

src/test/rustdoc/keyword.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// @has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Keywords'
88
// @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#keywords'
99
// @has foo/keyword.match.html '//a[@class="keyword"]' 'match'
10-
// @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match'
10+
// @has foo/keyword.match.html '//h1[@class="fqn"]' 'Keyword match'
1111
// @has foo/keyword.match.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
1212
// @has foo/index.html '//a/@href' '../foo/index.html'
1313
// @!has foo/foo/index.html

src/test/rustdoc/primitive-reference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// @has - '//div[@class="sidebar-elems"]//li/a/@href' '#primitives'
1010
// @has foo/primitive.reference.html
1111
// @has - '//a[@class="primitive"]' 'reference'
12-
// @has - '//span[@class="in-band"]' 'Primitive Type reference'
12+
// @has - '//h1[@class="fqn"]' 'Primitive Type reference'
1313
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
1414

1515
// There should be only one implementation listed.

src/test/rustdoc/primitive-slice-auto-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![feature(rustdoc_internals)]
55

66
// @has foo/primitive.slice.html '//a[@class="primitive"]' 'slice'
7-
// @has - '//span[@class="in-band"]' 'Primitive Type slice'
7+
// @has - '//h1[@class="fqn"]' 'Primitive Type slice'
88
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
99
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
1010
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T]where T: Send'

src/test/rustdoc/primitive-tuple-auto-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![feature(rustdoc_internals)]
55

66
// @has foo/primitive.tuple.html '//a[@class="primitive"]' 'tuple'
7-
// @has - '//span[@class="in-band"]' 'Primitive Type tuple'
7+
// @has - '//h1[@class="fqn"]' 'Primitive Type tuple'
88
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
99
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
1010
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'Send'

src/test/rustdoc/primitive-unit-auto-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![feature(rustdoc_internals)]
55

66
// @has foo/primitive.unit.html '//a[@class="primitive"]' 'unit'
7-
// @has - '//span[@class="in-band"]' 'Primitive Type unit'
7+
// @has - '//h1[@class="fqn"]' 'Primitive Type unit'
88
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
99
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
1010
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl Send for ()'

src/test/rustdoc/primitive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// @has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Primitive Types'
88
// @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#primitives'
99
// @has foo/primitive.i32.html '//a[@class="primitive"]' 'i32'
10-
// @has foo/primitive.i32.html '//span[@class="in-band"]' 'Primitive Type i32'
10+
// @has foo/primitive.i32.html '//h1[@class="fqn"]' 'Primitive Type i32'
1111
// @has foo/primitive.i32.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
1212
// @has foo/index.html '//a/@href' '../foo/index.html'
1313
// @!has foo/index.html '//span' '🔒'

0 commit comments

Comments
 (0)