{# #}
{# 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 e651501a184a8..d6fb83117c235 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 eca21e559896a..848f0a11f03ca 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2738,7 +2738,7 @@ impl<'test> TestCx<'test> {
#[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 ecfbb1955e779..5cdc4d53ab500 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 f1a2675128ce4..6d6e353ae362b 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 7a0194c6cc1f6..ffedbcf27761c 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| == 711 && |second_line_y| == 734
// 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 e576385cd5370..a9eee53dd1d50 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 e2a8a43007eb0..b8fa26b17f6b6 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 ec31f492abe7c..4a062fec7516d 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 4fc1c1ac065f4..d8f31f3774779 100644
--- a/tests/rustdoc-gui/scrape-examples-layout.goml
+++ b/tests/rustdoc-gui/scrape-examples-layout.goml
@@ -39,8 +39,8 @@ assert-property: (
store-value: (offset_y, 4)
// First with desktop
-assert-position: (".scraped-example .code-wrapper", {"y": 226})
-assert-position: (".scraped-example .code-wrapper .prev", {"y": 226 + |offset_y|})
+assert-position: (".scraped-example .code-wrapper", {"y": 253})
+assert-position: (".scraped-example .code-wrapper .prev", {"y": 253 + |offset_y|})
// Then with mobile
set-window-size: (600, 600)
diff --git a/tests/rustdoc-gui/search-form-elements.goml b/tests/rustdoc-gui/search-form-elements.goml
index 63d2ceb3e7c1c..efe39f7a9d1bf 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 3ca46f3c56931..c69ca59d44a7c 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 `