+{% match file_path %}
+{% when Some with ((path, name)) %}
+
{# #}
+
{# #}
+
{{path}}/
+ {{name}}
+
{# #}
+ {# #}
+
+{% else %}
+{% endmatch %}
+
{# #}
{# https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr
Do not show "1 2 3 4 5 ..." in web search results. #}
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 6649e1721a4..5f303d96c40 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -10,6 +10,7 @@
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(never_type)]
+#![feature(os_str_display)]
#![feature(round_char_boundary)]
#![feature(test)]
#![feature(type_alias_impl_trait)]
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index c18f569e528..d24dd334a34 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2739,7 +2739,7 @@ fn compare_to_default_rustdoc(&mut self, out_dir: &Path) {
#[rustfmt::skip]
let tidy_args = [
- "--new-blocklevel-tags", "rustdoc-search",
+ "--new-blocklevel-tags", "rustdoc-search,rustdoc-toolbar",
"--indent", "yes",
"--indent-spaces", "2",
"--wrap", "0",
diff --git a/src/tools/html-checker/main.rs b/src/tools/html-checker/main.rs
index ecfbb1955e7..5cdc4d53ab5 100644
--- a/src/tools/html-checker/main.rs
+++ b/src/tools/html-checker/main.rs
@@ -31,7 +31,7 @@ fn check_html_file(file: &Path) -> usize {
.arg("--mute-id") // this option is useful in case we want to mute more warnings
.arg("yes")
.arg("--new-blocklevel-tags")
- .arg("rustdoc-search") // custom elements
+ .arg("rustdoc-search,rustdoc-toolbar") // custom elements
.arg("--mute")
.arg(&to_mute_s)
.arg(file);
diff --git a/tests/rustdoc-gui/help-page.goml b/tests/rustdoc-gui/help-page.goml
index f1a2675128c..6d6e353ae36 100644
--- a/tests/rustdoc-gui/help-page.goml
+++ b/tests/rustdoc-gui/help-page.goml
@@ -4,7 +4,7 @@ set-window-size: (1000, 1000) // Try desktop size first.
wait-for: "#help"
assert-css: ("#help", {"display": "block"})
assert-css: ("#help dd", {"font-size": "16px"})
-click: "#help-button > a"
+assert-false: "#help-button > a"
assert-css: ("#help", {"display": "block"})
compare-elements-property: (".sub", "#help", ["offsetWidth"])
compare-elements-position: (".sub", "#help", ["x"])
@@ -50,7 +50,8 @@ call-function: ("check-colors", {
})
// This test ensures that opening the help popover without switching pages works.
-go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a"
+wait-for: "#search-tabs" // Waiting for the search.js to load.
set-window-size: (1000, 1000) // Only supported on desktop.
assert-false: "#help"
click: "#help-button > a"
@@ -62,7 +63,8 @@ compare-elements-property-false: (".sub", "#help", ["offsetWidth"])
compare-elements-position-false: (".sub", "#help", ["x"])
// This test ensures that the "the rustdoc book" anchor link within the help popover works.
-go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a"
+wait-for: "#search-tabs" // Waiting for the search.js to load.
set-window-size: (1000, 1000) // Popover only appears when the screen width is >700px.
assert-false: "#help"
click: "#help-button > a"
diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml
index 7a0194c6cc1..debda8d06c2 100644
--- a/tests/rustdoc-gui/item-info.goml
+++ b/tests/rustdoc-gui/item-info.goml
@@ -20,7 +20,7 @@ store-position: (
{"x": second_line_x, "y": second_line_y},
)
assert: |first_line_x| != |second_line_x| && |first_line_x| == 516 && |second_line_x| == 272
-assert: |first_line_y| != |second_line_y| && |first_line_y| == 688 && |second_line_y| == 711
+assert: |first_line_y| != |second_line_y| && |first_line_y| == 715 && |second_line_y| == 738
// Now we ensure that they're not rendered on the same line.
set-window-size: (1100, 800)
diff --git a/tests/rustdoc-gui/mobile.goml b/tests/rustdoc-gui/mobile.goml
index e576385cd53..a9eee53dd1d 100644
--- a/tests/rustdoc-gui/mobile.goml
+++ b/tests/rustdoc-gui/mobile.goml
@@ -5,23 +5,8 @@ set-window-size: (400, 600)
set-font-size: 18
wait-for: 100 // wait a bit for the resize and the font-size change to be fully taken into account.
-// The out-of-band info (source, stable version, collapse) should be below the
-// h1 when the screen gets narrow enough.
-assert-css: (".main-heading", {
- "display": "flex",
- "flex-direction": "column"
-})
-
assert-property: (".mobile-topbar h2", {"offsetHeight": 33})
-// Note: We can't use assert-text here because the 'Since' is set by CSS and
-// is therefore not part of the DOM.
-assert-css: (".content .out-of-band .since::before", { "content": "\"Since \"" })
-
-set-window-size: (1000, 1000)
-wait-for: 100 // wait a bit for the resize to be fully taken into account.
-assert-css-false: (".content .out-of-band .since::before", { "content": "\"Since \"" })
-
// On the settings page, the theme buttons should not line-wrap. Instead, they should
// all be placed as a group on a line below the setting name "Theme."
go-to: "file://" + |DOC_PATH| + "/settings.html"
diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml
index e2a8a43007e..b8fa26b17f6 100644
--- a/tests/rustdoc-gui/notable-trait.goml
+++ b/tests/rustdoc-gui/notable-trait.goml
@@ -248,12 +248,13 @@ click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']"
assert-count: ("//*[@class='tooltip popover']", 1)
assert-false: "//*[@class='sidebar shown']"
-// Also check the focus handling for the help button.
+// Also check the focus handling for the settings button.
set-window-size: (1100, 600)
reload:
assert-count: ("//*[@class='tooltip popover']", 0)
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']"
assert-count: ("//*[@class='tooltip popover']", 1)
-click: "#help-button a"
+click: "#settings-menu a"
+wait-for: "#settings"
assert-count: ("//*[@class='tooltip popover']", 0)
assert-false: "#method\.create_an_iterator_from_read .tooltip:focus"
diff --git a/tests/rustdoc-gui/pocket-menu.goml b/tests/rustdoc-gui/pocket-menu.goml
index ec31f492abe..4a062fec751 100644
--- a/tests/rustdoc-gui/pocket-menu.goml
+++ b/tests/rustdoc-gui/pocket-menu.goml
@@ -1,6 +1,7 @@
// This test ensures that the "pocket menus" are working as expected.
include: "utils.goml"
-go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test"
+wait-for: "#crate-search"
// First we check that the help menu doesn't exist yet.
assert-false: "#help-button .popover"
// Then we display the help menu.
diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml
index 6bea352bce4..55187a3e596 100644
--- a/tests/rustdoc-gui/scrape-examples-layout.goml
+++ b/tests/rustdoc-gui/scrape-examples-layout.goml
@@ -72,8 +72,8 @@ click: ".scraped-example .button-holder .expand"
store-value: (offset_y, 4)
// First with desktop
-assert-position: (".scraped-example", {"y": 226})
-assert-position: (".scraped-example .prev", {"y": 226 + |offset_y|})
+assert-position: (".scraped-example", {"y": 253})
+assert-position: (".scraped-example .prev", {"y": 253 + |offset_y|})
// Gradient background should be at the top of the code block.
assert-css: (".scraped-example .example-wrap::before", {"top": "0px"})
diff --git a/tests/rustdoc-gui/search-form-elements.goml b/tests/rustdoc-gui/search-form-elements.goml
index 63d2ceb3e7c..efe39f7a9d1 100644
--- a/tests/rustdoc-gui/search-form-elements.goml
+++ b/tests/rustdoc-gui/search-form-elements.goml
@@ -1,13 +1,14 @@
// This test ensures that the elements in ".search-form" have the expected display.
include: "utils.goml"
-go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test"
+wait-for: "#search-tabs" // Waiting for the search.js to load.
show-text: true
define-function: (
"check-search-colors",
[
theme, border, background, search_input_color, search_input_border_focus,
- menu_button_border, menu_button_a_color, menu_button_a_border_hover, menu_a_color,
+ menu_button_a_color, menu_button_a_border_hover, menu_a_color,
],
block {
call-function: ("switch-theme", {"theme": |theme|})
@@ -29,30 +30,22 @@ define-function: (
"color": |search_input_color|,
},
)
- assert-css: (
- "#help-button",
- {"border-color": |menu_button_border|},
- )
assert-css: (
"#help-button > a",
{
"color": |menu_button_a_color|,
- "border-color": |border|,
- "background-color": |background|,
+ "border-color": "transparent",
+ "background-color": "transparent",
},
)
// Hover help button.
move-cursor-to: "#help-button"
- assert-css: (
- "#help-button:hover",
- {"border-color": |menu_button_border|},
- )
assert-css: (
"#help-button > a",
{
"color": |menu_button_a_color|,
"border-color": |menu_button_a_border_hover|,
- "background-color": |background|,
+ "background-color": "transparent",
},
)
// Link color inside
@@ -63,30 +56,22 @@ define-function: (
"color": |menu_a_color|,
},
)
- assert-css: (
- "#settings-menu",
- {"border-color": |menu_button_border|},
- )
assert-css: (
"#settings-menu > a",
{
"color": |menu_button_a_color|,
- "border-color": |border|,
- "background-color": |background|,
+ "border-color": "transparent",
+ "background-color": "transparent",
},
)
// Hover settings menu.
move-cursor-to: "#settings-menu"
- assert-css: (
- "#settings-menu:hover",
- {"border-color": |menu_button_border|},
- )
assert-css: (
"#settings-menu:hover > a",
{
"color": |menu_button_a_color|,
"border-color": |menu_button_a_border_hover|,
- "background-color": |background|,
+ "background-color": "transparent",
},
)
},
@@ -100,8 +85,7 @@ call-function: (
"background": "#141920",
"search_input_color": "#fff",
"search_input_border_focus": "#5c6773",
- "menu_button_border": "#c5c5c5",
- "menu_button_a_color": "#fff",
+ "menu_button_a_color": "#c5c5c5",
"menu_button_a_border_hover": "#e0e0e0",
"menu_a_color": "#39afd7",
}
@@ -114,8 +98,7 @@ call-function: (
"background": "#f0f0f0",
"search_input_color": "#111",
"search_input_border_focus": "#008dfd",
- "menu_button_border": "#ddd",
- "menu_button_a_color": "#000",
+ "menu_button_a_color": "#ddd",
"menu_button_a_border_hover": "#ffb900",
"menu_a_color": "#d2991d",
}
@@ -128,7 +111,6 @@ call-function: (
"background": "#fff",
"search_input_color": "#000",
"search_input_border_focus": "#66afe9",
- "menu_button_border": "#000",
"menu_button_a_color": "#000",
"menu_button_a_border_hover": "#717171",
"menu_a_color": "#3873ad",
diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml
index 3ca46f3c569..c69ca59d44a 100644
--- a/tests/rustdoc-gui/search-result-display.goml
+++ b/tests/rustdoc-gui/search-result-display.goml
@@ -51,7 +51,10 @@ set-window-size: (900, 900)
// First we check the current width, height and position.
assert-css: ("#crate-search", {"width": "223px"})
-assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
+store-size: (".search-results-title", {
+ "height": search_results_title_height,
+ "width": search_results_title_width,
+})
assert-css: ("#search", {"width": "640px"})
// Then we update the text of one of the `