rustdoc: make the header show all three buttons

This tweaks it to use less space for the breadcrumbs.
This commit is contained in:
Michael Howell 2024-09-02 19:42:28 -07:00
parent d05323c7b4
commit 5b1b2e97e3
26 changed files with 154 additions and 102 deletions

View File

@ -177,12 +177,21 @@ h1, h2, h3, h4 {
position: relative;
display: grid;
grid-template-areas:
"main-heading-breadcrumbs main-heading-breadcrumbs"
"main-heading-h1 main-heading-toolbar"
"main-heading-sub-heading main-heading-toolbar";
grid-template-columns: 1fr max-content;
grid-template-rows: 25px min-content min-content;
padding-bottom: 6px;
margin-bottom: 15px;
}
.rustdoc-breadcrumbs {
grid-area: main-heading-breadcrumbs;
height: 25px;
line-height: 1.25;
display: flex;
align-items: end;
}
/* The only headings that get underlines are:
Markdown-generated headings within the top-doc
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
@ -228,6 +237,7 @@ a.src,
rustdoc-toolbar,
summary.hideme,
.scraped-example-list,
.rustdoc-breadcrumbs,
/* This selector is for the items listed in the "all items" page. */
ul.all-items {
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
@ -890,9 +900,10 @@ both the code example and the line numbers, so we need to remove the radius in t
}
.sub-heading {
font-size: 1rem;
flex-grow: 0;
font-size: 1.125rem;
grid-area: main-heading-sub-heading;
line-height: 1.25;
}
.main-heading rustdoc-toolbar, .main-heading .out-of-band {
@ -953,7 +964,7 @@ div.where {
nav.sub {
flex-grow: 1;
flex-flow: row nowrap;
margin: 4px 0 25px 0;
margin: 4px 0 0 0;
display: flex;
align-items: center;
}
@ -964,7 +975,7 @@ nav.sub {
flex-grow: 1;
}
.src nav.sub {
margin: 0 0 15px 0;
margin: 0 0 -10px 0;
}
.section-header {
@ -1074,6 +1085,11 @@ table,
with boxes (i.e. from the flex layout) */
align-items: baseline;
}
.search-results-title + .sub-heading {
color: var(--main-color);
display: flex;
align-items: center;
}
#crate-search-div {
/* ensures that 100% in properties of #crate-search-div:after
are relative to the size of this div */
@ -1298,15 +1314,15 @@ so that we can apply CSS-filters to change the arrow color in themes */
}
#settings.popover {
--popover-arrow-offset: 118px;
top: 26px;
--popover-arrow-offset: 202px;
top: calc(100% - 12px);
}
/* use larger max-width for help popover, but not for help.html */
#help.popover {
max-width: 600px;
--popover-arrow-offset: 36px;
top: 26px;
--popover-arrow-offset: 118px;
top: calc(100% - 12px);
}
#help dt {
@ -1722,7 +1738,6 @@ a.tooltip:hover::after {
}
#search-tabs {
grid-area: main-heading-sub-heading;
margin-top: 0.25rem;
display: flex;
flex-direction: row;
@ -1788,7 +1803,7 @@ a.tooltip:hover::after {
#settings-menu, #help-button, button#toggle-all-docs {
margin-left: var(--button-left-margin);
display: flex;
line-height: initial;
line-height: 1.25;
}
#sidebar-button {
display: none;
@ -1873,7 +1888,8 @@ button#toggle-all-docs:before {
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg" fill="none">\
<circle r="5.25" cx="6" cy="6" stroke-width="1.25" stroke="black"/>\
<text x="4.25" y="9" style="font:8px sans-serif;font-weight:1000" fill="black">?</text></svg>');
<text x="6" y="7" style="font:8px sans-serif;font-weight:1000" text-anchor="middle" \
dominant-baseline="middle" fill="black">?</text></svg>');
width: 18px;
height: 18px;
filter: var(--settings-menu-filter);
@ -1894,10 +1910,19 @@ button#toggle-all-docs:before,
}
}
button[disabled]#toggle-all-docs {
opacity: 0.25;
border: solid 1px var(--main-background-color);
background-size: cover;
}
button[disabled]#toggle-all-docs:hover {
border: solid 1px var(--main-background-color);
cursor: not-allowed;
}
rustdoc-toolbar span.label {
font-size: initial;
font-variant-caps: small-caps;
text-transform: lowercase;
font-size: 1rem;
flex-grow: 1;
}
@ -2155,15 +2180,6 @@ However, it's not needed with smaller screen width because the doc/code block is
opacity: 0.75;
}
/* help button is mostly for search */
#help-button:not(.help-open),
#alternative-display #toggle-all-docs {
display: none;
}
#alternative-display #help-button {
display: flex;
}
/* Media Queries */
/* Make sure all the buttons line wrap at the same time */
@ -2206,12 +2222,10 @@ in src-script.js and main.js
width: 33px;
}
#settings.popover {
--popover-arrow-offset: 48px;
top: calc(100% - 8px);
--popover-arrow-offset: 86px;
}
#help.popover {
--popover-arrow-offset: 12px;
top: calc(100% - 8px);
--popover-arrow-offset: 48px;
}
.rustdoc {
@ -2257,6 +2271,9 @@ in src-script.js and main.js
.src .search-form {
margin-left: 40px;
}
.src .main-heading {
margin-left: 8px;
}
.hide-sidebar .search-form {
margin-left: 32px;
}
@ -2394,7 +2411,7 @@ in src-script.js and main.js
}
.src nav.sub {
margin: 0;
margin: 0 0 -25px 0;
padding: var(--nav-sub-mobile-padding);
}
}

View File

@ -19,6 +19,10 @@ function resourcePath(basename, extension) {
function hideMain() {
addClass(document.getElementById(MAIN_ID), "hidden");
const toggle = document.getElementById("toggle-all-docs");
if (toggle) {
toggle.setAttribute("disabled", "disabled");
}
}
function showMain() {
@ -31,6 +35,10 @@ function showMain() {
}
mainHeading.appendChild(searchState.rustdocToolbar);
}
const toggle = document.getElementById("toggle-all-docs");
if (toggle) {
toggle.removeAttribute("disabled");
}
}
window.rootPath = getVar("root-path");

View File

@ -3597,16 +3597,16 @@ async function showResults(results, go_to_first, filterCrates) {
let crates = "";
if (rawSearchIndex.size > 1) {
crates = " in&nbsp;<div id=\"crate-search-div\"><select id=\"crate-search\">" +
"<option value=\"all crates\">all crates</option>";
crates = "<div class=\"sub-heading\"> in&nbsp;<div id=\"crate-search-div\">" +
"<select id=\"crate-search\"><option value=\"all crates\">all crates</option>";
for (const c of rawSearchIndex.keys()) {
crates += `<option value="${c}" ${c === filterCrates && "selected"}>${c}</option>`;
}
crates += "</select></div>";
crates += "</select></div></div>";
}
let output = `<div class="main-heading">\
<h1 class="search-results-title">Results${crates}</h1></div>`;
<h1 class="search-results-title">Results</h1>${crates}</div>`;
if (results.query.error !== null) {
const error = results.query.error;
error.forEach((value, index) => {

View File

@ -293,10 +293,10 @@ class RustdocToolbarElement extends HTMLElement {
<div id="settings-menu" tabindex="-1">
<a href="${rootPath}settings.html"><span class="label">Settings</span></a>
</div>
<button id="toggle-all-docs"><span class="label">Summary</span></button>
<div id="help-button" tabindex="-1">
<a href="${rootPath}help.html"><span class="label">Help</span></a>
</div>`;
</div>
<button id="toggle-all-docs"><span class="label">Summary</span></button>`;
}
}
window.customElements.define("rustdoc-toolbar", RustdocToolbarElement);

View File

@ -1,11 +1,16 @@
<div class="main-heading"> {# #}
<h1>
{{typ}}
{# The breadcrumbs of the item path, like std::string #}
{% if !path_components.is_empty() %}
<span class="rustdoc-breadcrumbs">
{% for component in path_components %}
<a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr>
{% endfor %}
<a class="{{item_type}}" href="#">{{name}}</a> {# #}
</span>
{% endif %}
<h1>
{{typ}}
<span{% if item_type != "mod" +%} class="{{item_type}}"{% endif %}>
{{name}}
</span> {# #}
<button id="copy-path" title="Copy item path to clipboard"> {# #}
Copy item path {# #}
</button> {# #}

View File

@ -12,8 +12,7 @@ define-function: (
call-function: ("switch-theme", {"theme": |theme|})
assert-css: ("#toggle-all-docs", {"color": |main_color|})
assert-css: (".main-heading h1 a:nth-of-type(1)", {"color": |main_heading_color|})
assert-css: (".main-heading a:nth-of-type(2)", {"color": |main_heading_type_color|})
assert-css: (".main-heading h1 span", {"color": |main_heading_type_color|})
assert-css: (
".rightside a.src",
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
@ -55,7 +54,7 @@ define-function: (
assert-css: ("#top-doc-prose-title", {"color": |title_color|})
assert-css: (".sidebar .block a", {"color": |sidebar_link_color|})
assert-css: (".main-heading h1 a", {"color": |title_color|})
assert-css: (".main-heading h1", {"color": |title_color|})
// We move the cursor over the "Implementations" title so the anchor is displayed.
move-cursor-to: "h2#implementations"

View File

@ -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| == 715 && |second_line_y| == 738
assert: |first_line_y| != |second_line_y| && |first_line_y| == 710 && |second_line_y| == 733
// Now we ensure that they're not rendered on the same line.
set-window-size: (1100, 800)

View File

@ -72,8 +72,8 @@ click: ".scraped-example .button-holder .expand"
store-value: (offset_y, 4)
// First with desktop
assert-position: (".scraped-example", {"y": 253})
assert-position: (".scraped-example .prev", {"y": 253 + |offset_y|})
assert-position: (".scraped-example", {"y": 248})
assert-position: (".scraped-example .prev", {"y": 248 + |offset_y|})
// Gradient background should be at the top of the code block.
assert-css: (".scraped-example .example-wrap::before", {"top": "0px"})
@ -82,8 +82,8 @@ assert-css: (".scraped-example .example-wrap::after", {"bottom": "0px"})
// Then with mobile
set-window-size: (600, 600)
store-size: (".scraped-example .scraped-example-title", {"height": title_height})
assert-position: (".scraped-example", {"y": 284})
assert-position: (".scraped-example .prev", {"y": 284 + |offset_y| + |title_height|})
assert-position: (".scraped-example", {"y": 277})
assert-position: (".scraped-example .prev", {"y": 277 + |offset_y| + |title_height|})
define-function: (
"check_title_and_code_position",

View File

@ -56,7 +56,8 @@ assert-property: ("#crate-search", {"value": "lib2"})
assert-false: "#results .externcrate"
// Checking that the text for the "title" is correct (the "all crates" comes from the "<select>").
assert-text: (".search-results-title", "Results in all crates", STARTS_WITH)
assert-text: (".search-results-title", "Results", STARTS_WITH)
assert-text: (".search-results-title + .sub-heading", " in all crates", STARTS_WITH)
// Checking the display of the crate filter.
// We start with the light theme.
@ -84,6 +85,6 @@ wait-for-css: ("#crate-search", {
click: "#theme-ayu"
wait-for-css: ("#crate-search", {
"border": "1px solid #5c6773",
"color": "#fff",
"color": "#c5c5c5",
"background-color": "#0f1419",
})

View File

@ -50,7 +50,7 @@ compare-elements-size-near: (
set-window-size: (900, 900)
// First we check the current width, height and position.
assert-css: ("#crate-search", {"width": "223px"})
assert-css: ("#crate-search", {"width": "159px"})
store-size: (".search-results-title", {
"height": search_results_title_height,
"width": search_results_title_width,
@ -64,7 +64,7 @@ set-text: (
)
// Then we compare again to confirm the height didn't change.
assert-size: ("#crate-search", {"width": 760})
assert-size: ("#crate-search", {"width": 509})
assert-size: (".search-results-title", {
"height": |search_results_title_height|,
})

View File

@ -16,4 +16,5 @@ assert-css: ("#main-content", {"display": "none"})
// Now we can check that the feature is working as expected!
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo&go_to_first=true"
// Waiting for the page to load...
wait-for-text: (".main-heading h1", "Struct test_docs::FooCopy item path")
wait-for-text: (".main-heading .rustdoc-breadcrumbs", "test_docs::")
wait-for-text: (".main-heading h1", "Struct FooCopy item path")

View File

@ -141,7 +141,7 @@ click: "#sidebar-button"
wait-for-css: (".src .sidebar > *", {"visibility": "hidden"})
// We scroll to line 117 to change the scroll position.
scroll-to: '//*[@id="117"]'
store-value: (y_offset, "2567")
store-value: (y_offset, "2564")
assert-window-property: {"pageYOffset": |y_offset|}
// Expanding the sidebar...
click: "#sidebar-button"

View File

@ -8,13 +8,13 @@ set-window-size: (600, 800)
assert-property: ("html", {"scrollTop": "0"})
click: '//a[text() = "barbar" and @href="#5-7"]'
assert-property: ("html", {"scrollTop": "196"})
assert-property: ("html", {"scrollTop": "194"})
click: '//a[text() = "bar" and @href="#28-36"]'
assert-property: ("html", {"scrollTop": "228"})
assert-property: ("html", {"scrollTop": "225"})
click: '//a[normalize-space() = "sub_fn" and @href="#2-4"]'
assert-property: ("html", {"scrollTop": "124"})
assert-property: ("html", {"scrollTop": "122"})
// We now check that clicking on lines doesn't change the scroll
// Extra information: the "sub_fn" function header is on line 1.
click: '//*[@id="6"]'
assert-property: ("html", {"scrollTop": "124"})
assert-property: ("html", {"scrollTop": "122"})

View File

@ -89,7 +89,7 @@ assert-css: (".src-line-numbers", {"text-align": "right"})
// do anything (and certainly not add a `#NaN` to the URL!).
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
// We use this assert-position to know where we will click.
assert-position: ("//*[@id='1']", {"x": 88, "y": 162})
assert-position: ("//*[@id='1']", {"x": 88, "y": 163})
// We click on the left of the "1" anchor but still in the "src-line-number" `<pre>`.
click: (163, 77)
assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
@ -159,19 +159,21 @@ call-function: ("check-sidebar-dir-entry", {
// Check the search form
assert-css: ("nav.sub", {"flex-direction": "row"})
// The goal of this test is to ensure the search input is perfectly centered
// between the top of the page and the top of the gray code block.
// between the top of the page and the header.
// To check this, we maintain the invariant:
//
// offsetTop[nav.sub form] = offsetTop[#main-content] - offsetHeight[nav.sub form] - offsetTop[nav.sub form]
assert-property: ("nav.sub form", {"offsetTop": 15, "offsetHeight": 34})
assert-property: ("#main-content", {"offsetTop": 64})
assert-position: ("nav.sub form", {"y": 15})
assert-property: ("nav.sub form", {"offsetHeight": 34})
assert-position: ("h1", {"y": 64})
// 15 = 64 - 34 - 15
// Now do the same check on moderately-sized, tablet mobile.
set-window-size: (700, 700)
assert-css: ("nav.sub", {"flex-direction": "row"})
assert-property: ("nav.sub form", {"offsetTop": 8, "offsetHeight": 34})
assert-property: ("#main-content", {"offsetTop": 50})
assert-position: ("nav.sub form", {"y": 8})
assert-property: ("nav.sub form", {"offsetHeight": 34})
assert-position: ("h1", {"y": 50})
// 8 = 50 - 34 - 8
// Check the sidebar directory entries have a marker and spacing (tablet).

View File

@ -53,6 +53,7 @@
--search-tab-button-selected-background: #fff;
--settings-menu-filter: none;
--settings-menu-hover-filter: invert(35%);
--settings-menu-disabled-filter: invert(14%) sepia(11%) saturate(14%) hue-rotate(337deg);
--stab-background-color: #fff5d6;
--stab-code-color: #000;
--code-highlight-kw-color: #8959a8;

View File

@ -12,4 +12,5 @@ assert-attribute-false: (".impl-items .toggle", {"open": ""})
// Click the "Trait" part of "impl Trait" and verify it navigates.
click: "#impl-Trait-for-Foo h3 a:first-of-type"
assert-text: (".main-heading h1", "Trait lib2::TraitCopy item path")
assert-text: (".main-heading .rustdoc-breadcrumbs", "lib2::")
assert-text: (".main-heading h1", "Trait TraitCopy item path")

View File

@ -3,12 +3,12 @@
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
set-window-size: (433, 600)
assert-attribute: (".top-doc", {"open": ""})
click: (4, 270) // This is the position of the top doc comment toggle
click: (4, 260) // This is the position of the top doc comment toggle
assert-attribute-false: (".top-doc", {"open": ""})
click: (4, 270)
click: (4, 260)
assert-attribute: (".top-doc", {"open": ""})
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
click: (3, 270)
click: (3, 260)
assert-attribute: (".top-doc", {"open": ""})
// Assert the position of the toggle on the top doc block.
@ -24,10 +24,10 @@ assert-position: (
// Now we do the same but with a little bigger width
set-window-size: (600, 600)
assert-attribute: (".top-doc", {"open": ""})
click: (4, 270) // New Y position since all search elements are back on one line.
click: (4, 260) // New Y position since all search elements are back on one line.
assert-attribute-false: (".top-doc", {"open": ""})
click: (4, 270)
click: (4, 260)
assert-attribute: (".top-doc", {"open": ""})
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
click: (3, 270)
click: (3, 260)
assert-attribute: (".top-doc", {"open": ""})

View File

@ -2,15 +2,18 @@
//@ has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo'
//@ hasraw 'empty_mod_private/sidebar-items.js' 'foo'
//@ matches 'empty_mod_private/foo/index.html' '//h1' 'Module empty_mod_private::foo'
//@ matches 'empty_mod_private/foo/index.html' '//h1' 'Module foo'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::'
mod foo {}
//@ has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar'
//@ hasraw 'empty_mod_private/sidebar-items.js' 'bar'
//@ matches 'empty_mod_private/bar/index.html' '//h1' 'Module empty_mod_private::bar'
//@ matches 'empty_mod_private/bar/index.html' '//h1' 'Module bar'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::'
mod bar {
//@ has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
//@ hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz'
//@ matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module empty_mod_private::bar::baz'
//@ matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module baz'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::bar::'
mod baz {}
}

View File

@ -1,14 +1,17 @@
//@ has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo'
//@ hasraw 'empty_mod_public/sidebar-items.js' 'foo'
//@ matches 'empty_mod_public/foo/index.html' '//h1' 'Module empty_mod_public::foo'
//@ matches 'empty_mod_public/foo/index.html' '//h1' 'Module foo'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::'
pub mod foo {}
//@ has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar'
//@ hasraw 'empty_mod_public/sidebar-items.js' 'bar'
//@ matches 'empty_mod_public/bar/index.html' '//h1' 'Module empty_mod_public::bar'
//@ matches 'empty_mod_public/bar/index.html' '//h1' 'Module bar'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::'
pub mod bar {
//@ has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
//@ hasraw 'empty_mod_public/bar/sidebar-items.js' 'baz'
//@ matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module empty_mod_public::bar::baz'
//@ matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module baz'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::bar::'
pub mod baz {}
}

View File

@ -10,15 +10,19 @@
//@ has - '//a/[@href="struct.DeprecatedStepBy.html"]' "DeprecatedStepBy"
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
//@ has foo/iter/struct.DeprecatedStepBy.html
//@ has - '//h1' "Struct foo::iter::DeprecatedStepBy"
//@ has - '//h1' "Struct DeprecatedStepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter::'
//@ has foo/iter/struct.StepBy.html
//@ has - '//h1' "Struct foo::iter::StepBy"
//@ has - '//h1' "Struct StepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter::'
//@ has bar/iter/index.html
//@ has - '//a/[@href="struct.DeprecatedStepBy.html"]' "DeprecatedStepBy"
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
//@ has bar/iter/struct.DeprecatedStepBy.html
//@ has - '//h1' "Struct bar::iter::DeprecatedStepBy"
//@ has - '//h1' "Struct DeprecatedStepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter::'
//@ has bar/iter/struct.StepBy.html
//@ has - '//h1' "Struct bar::iter::StepBy"
//@ has - '//h1' "Struct StepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter::'
pub use foo::iter;

View File

@ -6,7 +6,6 @@
//@ has foo/index.html '//a[@href="keyword.match.html"]' 'match'
//@ has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Keywords'
//@ has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#keywords'
//@ has foo/keyword.match.html '//a[@class="keyword"]' 'match'
//@ has foo/keyword.match.html '//h1' 'Keyword match'
//@ has foo/keyword.match.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
//@ has foo/index.html '//a/@href' '../foo/index.html'

View File

@ -8,7 +8,6 @@
//@ has - '//div[@class="sidebar-elems"]//li/a' 'Primitive Types'
//@ has - '//div[@class="sidebar-elems"]//li/a/@href' '#primitives'
//@ has foo/primitive.reference.html
//@ has - '//a[@class="primitive"]' 'reference'
//@ has - '//h1' 'Primitive Type reference'
//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'

View File

@ -3,8 +3,7 @@
#![crate_name = "foo"]
#![feature(rustc_attrs)]
//@ has foo/primitive.slice.html '//a[@class="primitive"]' 'slice'
//@ has - '//h1' 'Primitive Type slice'
//@ has foo/primitive.slice.html '//h1' 'Primitive Type slice'
//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
//@ has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
//@ has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T]where T: Send'

View File

@ -3,8 +3,7 @@
#![crate_name = "foo"]
#![feature(rustc_attrs)]
//@ has foo/primitive.tuple.html '//a[@class="primitive"]' 'tuple'
//@ has - '//h1' 'Primitive Type tuple'
//@ has foo/primitive.tuple.html '//h1' 'Primitive Type tuple'
//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
//@ has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
//@ has - '//div[@id="synthetic-implementations-list"]//h3' 'Send'

View File

@ -3,8 +3,7 @@
#![crate_name = "foo"]
#![feature(rustc_attrs)]
//@ has foo/primitive.unit.html '//a[@class="primitive"]' 'unit'
//@ has - '//h1' 'Primitive Type unit'
//@ has foo/primitive.unit.html '//h1' 'Primitive Type unit'
//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
//@ has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
//@ has - '//div[@id="synthetic-implementations-list"]//h3' 'impl Send for ()'

View File

@ -5,53 +5,65 @@
//@ matches 'foo/index.html' '//div[@class="sidebar-crate"]/h2/a' 'foo'
//@ count 'foo/index.html' '//h2[@class="location"]' 0
//@ matches 'foo/foo_mod/index.html' '//h1' 'Module foo::foo_mod'
//@ matches 'foo/foo_mod/index.html' '//h2[@class="location"]' 'Module foo_mod'
//@ matches 'foo/foo_mod/index.html' '//h1' 'Module foo_mod'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'Module foo_mod'
pub mod foo_mod {
pub struct __Thing {}
}
extern "C" {
//@ matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo::foo_ffn'
//@ matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo_ffn'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub fn foo_ffn();
}
//@ matches 'foo/fn.foo_fn.html' '//h1' 'Function foo::foo_fn'
//@ matches 'foo/fn.foo_fn.html' '//h1' 'Function foo_fn'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub fn foo_fn() {}
//@ matches 'foo/trait.FooTrait.html' '//h1' 'Trait foo::FooTrait'
//@ matches 'foo/trait.FooTrait.html' '//h2[@class="location"]' 'FooTrait'
//@ matches 'foo/trait.FooTrait.html' '//h1' 'Trait FooTrait'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'FooTrait'
pub trait FooTrait {}
//@ matches 'foo/struct.FooStruct.html' '//h1' 'Struct foo::FooStruct'
//@ matches 'foo/struct.FooStruct.html' '//h2[@class="location"]' 'FooStruct'
//@ matches 'foo/struct.FooStruct.html' '//h1' 'Struct FooStruct'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'FooStruct'
pub struct FooStruct;
//@ matches 'foo/enum.FooEnum.html' '//h1' 'Enum foo::FooEnum'
//@ matches 'foo/enum.FooEnum.html' '//h2[@class="location"]' 'FooEnum'
//@ matches 'foo/enum.FooEnum.html' '//h1' 'Enum FooEnum'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'FooEnum'
pub enum FooEnum {}
//@ matches 'foo/type.FooType.html' '//h1' 'Type Alias foo::FooType'
//@ matches 'foo/type.FooType.html' '//h2[@class="location"]' 'FooType'
//@ matches 'foo/type.FooType.html' '//h1' 'Type Alias FooType'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'FooType'
pub type FooType = FooStruct;
//@ matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo::foo_macro'
//@ matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo_macro'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
#[macro_export]
macro_rules! foo_macro {
() => {};
}
//@ matches 'foo/primitive.bool.html' '//h1' 'Primitive Type bool'
//@ count - '//*[@class="rustdoc-breadcrumbs"]' 0
#[rustc_doc_primitive = "bool"]
mod bool {}
//@ matches 'foo/static.FOO_STATIC.html' '//h1' 'Static foo::FOO_STATIC'
//@ matches 'foo/static.FOO_STATIC.html' '//h1' 'Static FOO_STATIC'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub static FOO_STATIC: FooStruct = FooStruct;
extern "C" {
//@ matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static foo::FOO_FSTATIC'
//@ matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static FOO_FSTATIC'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub static FOO_FSTATIC: FooStruct;
}
//@ matches 'foo/constant.FOO_CONSTANT.html' '//h1' 'Constant foo::FOO_CONSTANT'
//@ matches 'foo/constant.FOO_CONSTANT.html' '//h1' 'Constant FOO_CONSTANT'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub const FOO_CONSTANT: FooStruct = FooStruct;