1
Fork 0

Rename ID "main" into "main-content"

This commit is contained in:
Guillaume Gomez 2021-11-29 17:14:05 +01:00
parent 1e55c31cbb
commit d7e998dd14
25 changed files with 88 additions and 90 deletions

View file

@ -1447,7 +1447,7 @@ fn init_id_map() -> FxHashMap<String, usize> {
map.insert("theme-choices".to_owned(), 1); map.insert("theme-choices".to_owned(), 1);
map.insert("settings-menu".to_owned(), 1); map.insert("settings-menu".to_owned(), 1);
map.insert("help-button".to_owned(), 1); map.insert("help-button".to_owned(), 1);
map.insert("main".to_owned(), 1); map.insert("main-content".to_owned(), 1);
map.insert("search".to_owned(), 1); map.insert("search".to_owned(), 1);
map.insert("crate-search".to_owned(), 1); map.insert("crate-search".to_owned(), 1);
map.insert("render-detail".to_owned(), 1); map.insert("render-detail".to_owned(), 1);

View file

@ -12,7 +12,7 @@ fn test_unique_id() {
"examples", "examples",
"method.into_iter", "method.into_iter",
"foo", "foo",
"main", "main-content",
"search", "search",
"methods", "methods",
"examples", "examples",
@ -28,7 +28,7 @@ fn test_unique_id() {
"examples-2", "examples-2",
"method.into_iter-1", "method.into_iter-1",
"foo-1", "foo-1",
"main-1", "main-content-1",
"search-1", "search-1",
"methods", "methods",
"examples-3", "examples-3",
@ -219,8 +219,8 @@ fn test_header_ids_multiple_blocks() {
); );
t( t(
&mut map, &mut map,
"# Main", "# Search",
"<h2 id=\"main-1\" class=\"section-header\"><a href=\"#main-1\">Main</a></h2>", "<h2 id=\"search-1\" class=\"section-header\"><a href=\"#search-1\">Search</a></h2>",
); );
t( t(
&mut map, &mut map,

View file

@ -4,7 +4,7 @@ of content is hidden by default (depending on the settings too), we have to over
rules. rules.
*/ */
#main .attributes { #main-content .attributes {
/* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */ /* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
margin-left: 0 !important; margin-left: 0 !important;
} }

View file

@ -201,7 +201,7 @@ details.rustdoc-toggle > summary::before,
div.impl-items > div:not(.docblock):not(.item-info), div.impl-items > div:not(.docblock):not(.item-info),
.content ul.crate a.crate, a.srclink, .content ul.crate a.crate, a.srclink,
/* This selector is for the items listed in the "all items" page. */ /* This selector is for the items listed in the "all items" page. */
#main > ul.docblock > li > a { #main-content > ul.docblock > li > a {
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif; font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
} }
@ -633,10 +633,10 @@ nav.sub {
display: inline-block; display: inline-block;
} }
#main { #main-content {
position: relative; position: relative;
} }
#main > .since { #main-content > .since {
top: inherit; top: inherit;
font-family: "Fira Sans", Arial, sans-serif; font-family: "Fira Sans", Arial, sans-serif;
} }
@ -755,7 +755,7 @@ nav.sub {
flex-basis: 100%; flex-basis: 100%;
} }
#main > .item-info { #main-content > .item-info {
margin-top: 0; margin-top: 0;
} }
@ -1521,10 +1521,10 @@ kbd {
left: -5px; left: -5px;
} }
#main > ul { #main-content > ul {
padding-left: 10px; padding-left: 10px;
} }
#main > ul > li { #main-content > ul > li {
list-style: none; list-style: none;
} }
@ -1920,8 +1920,8 @@ details.rustdoc-toggle[open] > summary.hideme::after {
border-bottom: 1px solid; border-bottom: 1px solid;
} }
#main > details.rustdoc-toggle > summary::before, #main-content > details.rustdoc-toggle > summary::before,
#main > div > details.rustdoc-toggle > summary::before { #main-content > div > details.rustdoc-toggle > summary::before {
left: -11px; left: -11px;
} }
@ -1954,7 +1954,7 @@ details.rustdoc-toggle[open] > summary.hideme::after {
z-index: 11; z-index: 11;
} }
#main > .line-numbers { #main-content > .line-numbers {
margin-top: 0; margin-top: 0;
} }
@ -2008,7 +2008,7 @@ details.rustdoc-toggle[open] > summary.hideme::after {
height: 73px; height: 73px;
} }
#main > table:not(.table-display) td { #main-content > table:not(.table-display) td {
word-break: break-word; word-break: break-word;
width: 50%; width: 50%;
} }

View file

@ -94,6 +94,7 @@ function getVirtualKey(ev) {
var THEME_PICKER_ELEMENT_ID = "theme-picker"; var THEME_PICKER_ELEMENT_ID = "theme-picker";
var THEMES_ELEMENT_ID = "theme-choices"; var THEMES_ELEMENT_ID = "theme-choices";
var MAIN_ID = "main-content";
function getThemesElement() { function getThemesElement() {
return document.getElementById(THEMES_ELEMENT_ID); return document.getElementById(THEMES_ELEMENT_ID);
@ -362,7 +363,7 @@ function hideThemeButtonState() {
} }
var toggleAllDocsId = "toggle-all-docs"; var toggleAllDocsId = "toggle-all-docs";
var main = document.getElementById("main"); var main = document.getElementById(MAIN_ID);
var savedHash = ""; var savedHash = "";
function handleHashes(ev) { function handleHashes(ev) {
@ -787,7 +788,7 @@ function hideThemeButtonState() {
} else { } else {
addClass(innerToggle, "will-expand"); addClass(innerToggle, "will-expand");
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function(e) { onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function(e) {
if (e.parentNode.id !== "main" || if (e.parentNode.id !== MAIN_ID ||
(!hasClass(e, "implementors-toggle") && (!hasClass(e, "implementors-toggle") &&
!hasClass(e, "type-contents-toggle"))) !hasClass(e, "type-contents-toggle")))
{ {

View file

@ -113,17 +113,17 @@ function createSourceSidebar() {
if (!window.rootPath.endsWith("/")) { if (!window.rootPath.endsWith("/")) {
window.rootPath += "/"; window.rootPath += "/";
} }
var main = document.querySelector("nav.sidebar"); var container = document.querySelector("nav.sidebar");
var sidebarToggle = createSidebarToggle(); var sidebarToggle = createSidebarToggle();
main.insertBefore(sidebarToggle, main.firstChild); container.insertBefore(sidebarToggle, container.firstChild);
var sidebar = document.createElement("div"); var sidebar = document.createElement("div");
sidebar.id = "source-sidebar"; sidebar.id = "source-sidebar";
if (getCurrentValue("rustdoc-source-sidebar-show") !== "true") { if (getCurrentValue("rustdoc-source-sidebar-show") !== "true") {
main.classList.remove("expanded"); container.classList.remove("expanded");
} else { } else {
main.classList.add("expanded"); container.classList.add("expanded");
} }
var currentFile = getCurrentFilePath(); var currentFile = getCurrentFilePath();
@ -139,7 +139,7 @@ function createSourceSidebar() {
currentFile, hasFoundFile); currentFile, hasFoundFile);
}); });
main.insertBefore(sidebar, document.querySelector(".sidebar-logo").nextSibling); container.insertBefore(sidebar, document.querySelector(".sidebar-logo").nextSibling);
// Focus on the current file in the source files sidebar. // Focus on the current file in the source files sidebar.
var selected_elem = sidebar.getElementsByClassName("selected")[0]; var selected_elem = sidebar.getElementsByClassName("selected")[0];
if (typeof selected_elem !== "undefined") { if (typeof selected_elem !== "undefined") {

View file

@ -125,7 +125,7 @@
</form> {#- -#} </form> {#- -#}
</nav> {#- -#} </nav> {#- -#}
</div> {#- -#} </div> {#- -#}
<section id="main" class="content">{{- content | safe -}}</section> {#- -#} <section id="main-content" class="content">{{- content | safe -}}</section> {#- -#}
<section id="search" class="content hidden"></section> {#- -#} <section id="search" class="content hidden"></section> {#- -#}
</div> {#- -#} </div> {#- -#}
</main> {#- -#} </main> {#- -#}

View file

@ -1,6 +1,6 @@
// This test ensures that the docblock elements have the appropriate left margin. // This test ensures that the docblock elements have the appropriate left margin.
goto: file://|DOC_PATH|/test_docs/fn.foo.html goto: file://|DOC_PATH|/test_docs/fn.foo.html
// The top docblock elements shouldn't have left margin... // The top docblock elements shouldn't have left margin...
assert-css: ("#main .docblock.item-decl", {"margin-left": "0px"}) assert-css: ("#main-content .docblock.item-decl", {"margin-left": "0px"})
// ... but all the others should! // ... but all the others should!
assert-css: ("#main .docblock:not(.item-decl)", {"margin-left": "24px"}) assert-css: ("#main-content .docblock:not(.item-decl)", {"margin-left": "24px"})

View file

@ -3,15 +3,15 @@ goto: file://|DOC_PATH|/test_docs/index.html
write: (".search-input", "test") write: (".search-input", "test")
wait-for: "#search > h1" // The search element is empty before the first search wait-for: "#search > h1" // The search element is empty before the first search
assert-attribute: ("#search", {"class": "content"}) assert-attribute: ("#search", {"class": "content"})
assert-attribute: ("#main", {"class": "content hidden"}) assert-attribute: ("#main-content", {"class": "content hidden"})
press-key: "Escape" press-key: "Escape"
assert-attribute: ("#search", {"class": "content hidden"}) assert-attribute: ("#search", {"class": "content hidden"})
assert-attribute: ("#main", {"class": "content"}) assert-attribute: ("#main-content", {"class": "content"})
// Check that focusing the search input brings back the search results // Check that focusing the search input brings back the search results
focus: ".search-input" focus: ".search-input"
assert-attribute: ("#search", {"class": "content"}) assert-attribute: ("#search", {"class": "content"})
assert-attribute: ("#main", {"class": "content hidden"}) assert-attribute: ("#main-content", {"class": "content hidden"})
// Now let's check that when the help popup is displayed and we press Escape, it doesn't // Now let's check that when the help popup is displayed and we press Escape, it doesn't
// hide the search results too. // hide the search results too.
@ -20,7 +20,7 @@ assert-attribute: ("#help", {"class": ""})
press-key: "Escape" press-key: "Escape"
assert-attribute: ("#help", {"class": "hidden"}) assert-attribute: ("#help", {"class": "hidden"})
assert-attribute: ("#search", {"class": "content"}) assert-attribute: ("#search", {"class": "content"})
assert-attribute: ("#main", {"class": "content hidden"}) assert-attribute: ("#main-content", {"class": "content hidden"})
// Check that Escape hides the search results when a search result is focused. // Check that Escape hides the search results when a search result is focused.
focus: ".search-input" focus: ".search-input"
@ -31,4 +31,4 @@ assert: "#results a:focus"
press-key: "Escape" press-key: "Escape"
assert-attribute: ("#help", {"class": "hidden"}) assert-attribute: ("#help", {"class": "hidden"})
assert-attribute: ("#search", {"class": "content hidden"}) assert-attribute: ("#search", {"class": "content hidden"})
assert-attribute: ("#main", {"class": "content"}) assert-attribute: ("#main-content", {"class": "content"})

View file

@ -1,3 +1,3 @@
// This test ensures that the impl blocks are open by default. // This test ensures that the impl blocks are open by default.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html goto: file://|DOC_PATH|/test_docs/struct.Foo.html
assert-attribute: ("#main > details.implementors-toggle", {"open": ""}) assert-attribute: ("#main-content > details.implementors-toggle", {"open": ""})

View file

@ -11,7 +11,7 @@ goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo
wait-for: "#titles" wait-for: "#titles"
assert-text-false: (".fqn .in-band", "Struct test_docs::Foo") assert-text-false: (".fqn .in-band", "Struct test_docs::Foo")
// Ensure that the search results are displayed, not the "normal" content. // Ensure that the search results are displayed, not the "normal" content.
assert-css: ("#main", {"display": "none"}) assert-css: ("#main-content", {"display": "none"})
// Now we can check that the feature is working as expected! // Now we can check that the feature is working as expected!
goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo&go_to_first=true goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo&go_to_first=true

View file

@ -1,10 +1,10 @@
goto: file://|DOC_PATH|/test_docs/index.html goto: file://|DOC_PATH|/test_docs/index.html
assert-attribute: ("#main > details.top-doc", {"open": ""}) assert-attribute: ("#main-content > details.top-doc", {"open": ""})
click: "#toggle-all-docs" click: "#toggle-all-docs"
wait-for: 1000 wait-for: 1000
// This is now collapsed so there shouldn't be the "open" attribute on details. // This is now collapsed so there shouldn't be the "open" attribute on details.
assert-attribute-false: ("#main > details.top-doc", {"open": ""}) assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
click: "#toggle-all-docs" click: "#toggle-all-docs"
wait-for: 1000 wait-for: 1000
// Not collapsed anymore so the "open" attribute should be back. // Not collapsed anymore so the "open" attribute should be back.
assert-attribute: ("#main > details.top-doc", {"open": ""}) assert-attribute: ("#main-content > details.top-doc", {"open": ""})

View file

@ -11,7 +11,7 @@ assert-property: (".item-decl pre", {"scrollWidth": "1324"})
goto: file://|DOC_PATH|/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html goto: file://|DOC_PATH|/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html
assert-property: ("body", {"scrollWidth": "1100"}) assert-property: ("body", {"scrollWidth": "1100"})
// We now check that the section width hasn't grown because of it. // We now check that the section width hasn't grown because of it.
assert-property: ("#main", {"scrollWidth": "840"}) assert-property: ("#main-content", {"scrollWidth": "840"})
// And now checking that it has scrollable content. // And now checking that it has scrollable content.
assert-property: (".item-decl pre", {"scrollWidth": "1103"}) assert-property: (".item-decl pre", {"scrollWidth": "1103"})
@ -20,6 +20,6 @@ assert-property: (".item-decl pre", {"scrollWidth": "1103"})
goto: file://|DOC_PATH|/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html goto: file://|DOC_PATH|/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html
assert-property: ("body", {"scrollWidth": "1100"}) assert-property: ("body", {"scrollWidth": "1100"})
// We now check that the section width hasn't grown because of it. // We now check that the section width hasn't grown because of it.
assert-property: ("#main", {"scrollWidth": "840"}) assert-property: ("#main-content", {"scrollWidth": "840"})
// And now checking that it has scrollable content. // And now checking that it has scrollable content.
assert-property: (".item-decl pre", {"scrollWidth": "950"}) assert-property: (".item-decl pre", {"scrollWidth": "950"})

View file

@ -2,7 +2,7 @@
#![feature(target_feature, cfg_target_feature)] #![feature(target_feature, cfg_target_feature)]
// @has doc_cfg/struct.Portable.html // @has doc_cfg/struct.Portable.html
// @!has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' '' // @!has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' ''
// @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()' // @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()'
// @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.' // @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.'
// @has - '//*[@id="method.wasi_and_wasm32_only_function"]' 'fn wasi_and_wasm32_only_function()' // @has - '//*[@id="method.wasi_and_wasm32_only_function"]' 'fn wasi_and_wasm32_only_function()'
@ -10,14 +10,14 @@
pub struct Portable; pub struct Portable;
// @has doc_cfg/unix_only/index.html \ // @has doc_cfg/unix_only/index.html \
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported on Unix only.' // 'This is supported on Unix only.'
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AARM\Z' // @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AARM\Z'
// @count - '//*[@class="stab portability"]' 2 // @count - '//*[@class="stab portability"]' 2
#[doc(cfg(unix))] #[doc(cfg(unix))]
pub mod unix_only { pub mod unix_only {
// @has doc_cfg/unix_only/fn.unix_only_function.html \ // @has doc_cfg/unix_only/fn.unix_only_function.html \
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported on Unix only.' // 'This is supported on Unix only.'
// @count - '//*[@class="stab portability"]' 1 // @count - '//*[@class="stab portability"]' 1
pub fn unix_only_function() { pub fn unix_only_function() {
@ -25,7 +25,7 @@ pub mod unix_only {
} }
// @has doc_cfg/unix_only/trait.ArmOnly.html \ // @has doc_cfg/unix_only/trait.ArmOnly.html \
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported on Unix and ARM only.' // 'This is supported on Unix and ARM only.'
// @count - '//*[@class="stab portability"]' 1 // @count - '//*[@class="stab portability"]' 1
#[doc(cfg(target_arch = "arm"))] #[doc(cfg(target_arch = "arm"))]
@ -40,14 +40,14 @@ pub mod unix_only {
} }
// @has doc_cfg/wasi_only/index.html \ // @has doc_cfg/wasi_only/index.html \
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported on WASI only.' // 'This is supported on WASI only.'
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z' // @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z'
// @count - '//*[@class="stab portability"]' 2 // @count - '//*[@class="stab portability"]' 2
#[doc(cfg(target_os = "wasi"))] #[doc(cfg(target_os = "wasi"))]
pub mod wasi_only { pub mod wasi_only {
// @has doc_cfg/wasi_only/fn.wasi_only_function.html \ // @has doc_cfg/wasi_only/fn.wasi_only_function.html \
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported on WASI only.' // 'This is supported on WASI only.'
// @count - '//*[@class="stab portability"]' 1 // @count - '//*[@class="stab portability"]' 1
pub fn wasi_only_function() { pub fn wasi_only_function() {
@ -55,7 +55,7 @@ pub mod wasi_only {
} }
// @has doc_cfg/wasi_only/trait.Wasm32Only.html \ // @has doc_cfg/wasi_only/trait.Wasm32Only.html \
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported on WASI and WebAssembly only.' // 'This is supported on WASI and WebAssembly only.'
// @count - '//*[@class="stab portability"]' 1 // @count - '//*[@class="stab portability"]' 1
#[doc(cfg(target_arch = "wasm32"))] #[doc(cfg(target_arch = "wasm32"))]
@ -77,7 +77,7 @@ pub mod wasi_only {
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\Aavx\Z' // @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\Aavx\Z'
// @has doc_cfg/fn.uses_target_feature.html // @has doc_cfg/fn.uses_target_feature.html
// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported with target feature avx only.' // 'This is supported with target feature avx only.'
#[target_feature(enable = "avx")] #[target_feature(enable = "avx")]
pub unsafe fn uses_target_feature() { pub unsafe fn uses_target_feature() {
@ -85,7 +85,7 @@ pub unsafe fn uses_target_feature() {
} }
// @has doc_cfg/fn.uses_cfg_target_feature.html // @has doc_cfg/fn.uses_cfg_target_feature.html
// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported with target feature avx only.' // 'This is supported with target feature avx only.'
#[doc(cfg(target_feature = "avx"))] #[doc(cfg(target_feature = "avx"))]
pub fn uses_cfg_target_feature() { pub fn uses_cfg_target_feature() {
@ -94,7 +94,7 @@ pub fn uses_cfg_target_feature() {
// multiple attributes should be allowed // multiple attributes should be allowed
// @has doc_cfg/fn.multiple_attrs.html \ // @has doc_cfg/fn.multiple_attrs.html \
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'This is supported on x and y and z only.' // 'This is supported on x and y and z only.'
#[doc(inline, cfg(x))] #[doc(inline, cfg(x))]
#[doc(cfg(y), cfg(z))] #[doc(cfg(y), cfg(z))]

View file

@ -2,7 +2,7 @@
// @has - '//h3[@class="code-header in-band"]' 'impl Foo' // @has - '//h3[@class="code-header in-band"]' 'impl Foo'
// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo' // @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo'
// @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 // @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1
// @count - '//*[@id="main"]/details/summary/*[@class="impl has-srclink"]' 1 // @count - '//*[@id="main-content"]/details/summary/*[@class="impl has-srclink"]' 1
// @has issue_33054/impls/bar/trait.Bar.html // @has issue_33054/impls/bar/trait.Bar.html
// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo' // @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo'
// @count - '//*[@class="struct"]' 1 // @count - '//*[@class="struct"]' 1

View file

@ -8,23 +8,23 @@ pub struct Bar;
impl Foo for Bar {} impl Foo for Bar {}
impl Foo2 for Bar {} impl Foo2 for Bar {}
// @has foo/fn.foo.html '//section[@id="main"]//pre' "x: &'x impl Foo" // @has foo/fn.foo.html '//section[@id="main-content"]//pre' "x: &'x impl Foo"
// @has foo/fn.foo.html '//section[@id="main"]//pre' "-> &'x impl Foo" // @has foo/fn.foo.html '//section[@id="main-content"]//pre' "-> &'x impl Foo"
pub fn foo<'x>(x: &'x impl Foo) -> &'x impl Foo { pub fn foo<'x>(x: &'x impl Foo) -> &'x impl Foo {
x x
} }
// @has foo/fn.foo2.html '//section[@id="main"]//pre' "x: &'x impl Foo" // @has foo/fn.foo2.html '//section[@id="main-content"]//pre' "x: &'x impl Foo"
// @has foo/fn.foo2.html '//section[@id="main"]//pre' '-> impl Foo2' // @has foo/fn.foo2.html '//section[@id="main-content"]//pre' '-> impl Foo2'
pub fn foo2<'x>(_x: &'x impl Foo) -> impl Foo2 { pub fn foo2<'x>(_x: &'x impl Foo) -> impl Foo2 {
Bar Bar
} }
// @has foo/fn.foo_foo.html '//section[@id="main"]//pre' '-> impl Foo + Foo2' // @has foo/fn.foo_foo.html '//section[@id="main-content"]//pre' '-> impl Foo + Foo2'
pub fn foo_foo() -> impl Foo + Foo2 { pub fn foo_foo() -> impl Foo + Foo2 {
Bar Bar
} }
// @has foo/fn.foo_foo_foo.html '//section[@id="main"]//pre' "x: &'x impl Foo + Foo2" // @has foo/fn.foo_foo_foo.html '//section[@id="main-content"]//pre' "x: &'x impl Foo + Foo2"
pub fn foo_foo_foo<'x>(_x: &'x (impl Foo + Foo2)) { pub fn foo_foo_foo<'x>(_x: &'x (impl Foo + Foo2)) {
} }

View file

@ -9,8 +9,8 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
// @has prim_methods_external_core/index.html // @has prim_methods_external_core/index.html
// @has - '//*[@id="main"]//a[@href="../my_core/primitive.char.html"]' 'char' // @has - '//*[@id="main-content"]//a[@href="../my_core/primitive.char.html"]' 'char'
// @has - '//*[@id="main"]//a[@href="../my_core/primitive.char.html#method.len_utf8"]' 'char::len_utf8' // @has - '//*[@id="main-content"]//a[@href="../my_core/primitive.char.html#method.len_utf8"]' 'char::len_utf8'
//! A [`char`] and its [`char::len_utf8`]. //! A [`char`] and its [`char::len_utf8`].

View file

@ -3,10 +3,9 @@
#![no_core] #![no_core]
#![crate_type = "rlib"] #![crate_type = "rlib"]
// @has prim_methods_local/index.html // @has prim_methods_local/index.html
// @has - '//*[@id="main"]//a[@href="primitive.char.html"]' 'char' // @has - '//*[@id="main-content"]//a[@href="primitive.char.html"]' 'char'
// @has - '//*[@id="main"]//a[@href="primitive.char.html#method.len_utf8"]' 'char::len_utf8' // @has - '//*[@id="main-content"]//a[@href="primitive.char.html#method.len_utf8"]' 'char::len_utf8'
//! A [prim@`char`] and its [`char::len_utf8`]. //! A [prim@`char`] and its [`char::len_utf8`].

View file

@ -1,8 +1,7 @@
#![deny(broken_intra_doc_links)] #![deny(broken_intra_doc_links)]
// @has prim_methods/index.html // @has prim_methods/index.html
// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html"]' 'char' // @has - '//*[@id="main-content"]//a[@href="{{channel}}/std/primitive.char.html"]' 'char'
// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' // @has - '//*[@id="main-content"]//a[@href="{{channel}}/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8'
//! A [`char`] and its [`char::len_utf8`]. //! A [`char`] and its [`char::len_utf8`].

View file

@ -1,9 +1,8 @@
#![deny(broken_intra_doc_links)] #![deny(broken_intra_doc_links)]
#![crate_name = "foo"] #![crate_name = "foo"]
// @has foo/index.html // @has foo/index.html
// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.bool.html"]' 'true' // @has - '//*[@id="main-content"]//a[@href="{{channel}}/std/primitive.bool.html"]' 'true'
// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.bool.html"]' 'false' // @has - '//*[@id="main-content"]//a[@href="{{channel}}/std/primitive.bool.html"]' 'false'
//! A `bool` is either [`true`] or [`false`]. //! A `bool` is either [`true`] or [`false`].

View file

@ -2,19 +2,19 @@
// @has issue_55364/subone/index.html // @has issue_55364/subone/index.html
// These foo/bar links in the module's documentation should refer inside `subone` // These foo/bar links in the module's documentation should refer inside `subone`
// @has - '//section[@id="main"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
// @has - '//section[@id="main"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' // @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
pub mod subone { pub mod subone {
//! See either [foo] or [bar]. //! See either [foo] or [bar].
// This should refer to subone's `bar` // This should refer to subone's `bar`
// @has issue_55364/subone/fn.foo.html // @has issue_55364/subone/fn.foo.html
// @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
/// See [bar] /// See [bar]
pub fn foo() {} pub fn foo() {}
// This should refer to subone's `foo` // This should refer to subone's `foo`
// @has issue_55364/subone/fn.bar.html // @has issue_55364/subone/fn.bar.html
// @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
/// See [foo] /// See [foo]
pub fn bar() {} pub fn bar() {}
} }
@ -23,27 +23,27 @@ pub mod subone {
// @has issue_55364/subtwo/index.html // @has issue_55364/subtwo/index.html
// These foo/bar links in the module's documentation should not reference inside `subtwo` // These foo/bar links in the module's documentation should not reference inside `subtwo`
// @!has - '//section[@id="main"]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' // @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
// @!has - '//section[@id="main"]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' // @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
// Instead it should be referencing the top level functions // Instead it should be referencing the top level functions
// @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo'
// @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar'
// Though there should be such links later // Though there should be such links later
// @has - '//section[@id="main"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.foo.html"]' 'foo'
// @has - '//section[@id="main"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.bar.html"]' 'bar' // @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.bar.html"]' 'bar'
/// See either [foo] or [bar]. /// See either [foo] or [bar].
pub mod subtwo { pub mod subtwo {
// Despite the module's docs referring to the top level foo/bar, // Despite the module's docs referring to the top level foo/bar,
// this should refer to subtwo's `bar` // this should refer to subtwo's `bar`
// @has issue_55364/subtwo/fn.foo.html // @has issue_55364/subtwo/fn.foo.html
// @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
/// See [bar] /// See [bar]
pub fn foo() {} pub fn foo() {}
// Despite the module's docs referring to the top level foo/bar, // Despite the module's docs referring to the top level foo/bar,
// this should refer to subtwo's `foo` // this should refer to subtwo's `foo`
// @has issue_55364/subtwo/fn.bar.html // @has issue_55364/subtwo/fn.bar.html
// @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
/// See [foo] /// See [foo]
pub fn bar() {} pub fn bar() {}
} }
@ -59,8 +59,8 @@ pub fn bar() {}
// @has issue_55364/subthree/index.html // @has issue_55364/subthree/index.html
// This module should also refer to the top level foo/bar // This module should also refer to the top level foo/bar
// @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo'
// @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar'
pub mod subthree { pub mod subthree {
//! See either [foo][super::foo] or [bar][super::bar] //! See either [foo][super::foo] or [bar][super::bar]
} }
@ -68,8 +68,8 @@ pub mod subthree {
// Next we go *deeper* - In order to ensure it's not just "this or parent" // Next we go *deeper* - In order to ensure it's not just "this or parent"
// we test `crate::` and a `super::super::...` chain // we test `crate::` and a `super::super::...` chain
// @has issue_55364/subfour/subfive/subsix/subseven/subeight/index.html // @has issue_55364/subfour/subfive/subsix/subseven/subeight/index.html
// @has - '//section[@id="main"]/div[@class="item-table"]//div[@class="item-right docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo' // @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-right docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo'
// @has - '//section[@id="main"]/div[@class="item-table"]//div[@class="item-right docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar' // @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-right docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar'
pub mod subfour { pub mod subfour {
pub mod subfive { pub mod subfive {
pub mod subsix { pub mod subsix {

View file

@ -8,7 +8,7 @@
// @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#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 '//a[@class="keyword"]' 'match'
// @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match' // @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match'
// @has foo/keyword.match.html '//section[@id="main"]//div[@class="docblock"]//p' 'this is a test!' // @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' // @has foo/index.html '//a/@href' '../foo/index.html'
// @!has foo/foo/index.html // @!has foo/foo/index.html
// @!has-dir foo/foo // @!has-dir foo/foo
@ -16,7 +16,7 @@
/// this is a test! /// this is a test!
mod foo{} mod foo{}
// @has foo/keyword.foo.html '//section[@id="main"]//div[@class="docblock"]//p' 'hello' // @has foo/keyword.foo.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
#[doc(keyword = "foo")] #[doc(keyword = "foo")]
/// hello /// hello
mod bar {} mod bar {}

View file

@ -3,7 +3,7 @@
pub struct Struc; pub struct Struc;
// @has foo/struct.Struc.html // @has foo/struct.Struc.html
// @has - '//*[@id="main"]/h2[@id="implementations"]' "Implementations" // @has - '//*[@id="main-content"]/h2[@id="implementations"]' "Implementations"
impl Struc { impl Struc {
pub const S: u64 = 0; pub const S: u64 = 0;
} }

View file

@ -14,13 +14,13 @@ use std::fmt::Debug;
// @has foo/index.html '//a[@class="traitalias"]' 'Foo' // @has foo/index.html '//a[@class="traitalias"]' 'Foo'
// @has foo/traitalias.CopyAlias.html // @has foo/traitalias.CopyAlias.html
// @has - '//section[@id="main"]/div[@class="docblock item-decl"]/pre' 'trait CopyAlias = Copy;' // @has - '//section[@id="main-content"]/div[@class="docblock item-decl"]/pre' 'trait CopyAlias = Copy;'
pub trait CopyAlias = Copy; pub trait CopyAlias = Copy;
// @has foo/traitalias.Alias2.html // @has foo/traitalias.Alias2.html
// @has - '//section[@id="main"]/div[@class="docblock item-decl"]/pre' 'trait Alias2 = Copy + Debug;' // @has - '//section[@id="main-content"]/div[@class="docblock item-decl"]/pre' 'trait Alias2 = Copy + Debug;'
pub trait Alias2 = Copy + Debug; pub trait Alias2 = Copy + Debug;
// @has foo/traitalias.Foo.html // @has foo/traitalias.Foo.html
// @has - '//section[@id="main"]/div[@class="docblock item-decl"]/pre' 'trait Foo<T> = Into<T> + Debug;' // @has - '//section[@id="main-content"]/div[@class="docblock item-decl"]/pre' 'trait Foo<T> = Into<T> + Debug;'
pub trait Foo<T> = Into<T> + Debug; pub trait Foo<T> = Into<T> + Debug;
// @has foo/fn.bar.html '//a[@href="traitalias.Alias2.html"]' 'Alias2' // @has foo/fn.bar.html '//a[@href="traitalias.Alias2.html"]' 'Alias2'
pub fn bar<T>() where T: Alias2 {} pub fn bar<T>() where T: Alias2 {}

View file

@ -4,11 +4,11 @@
// @has - '//h2[@id="fields"]' 'Tuple Fields' // @has - '//h2[@id="fields"]' 'Tuple Fields'
// @has - '//h3[@class="sidebar-title"]/a[@href="#fields"]' 'Tuple Fields' // @has - '//h3[@class="sidebar-title"]/a[@href="#fields"]' 'Tuple Fields'
// @has - '//*[@id="structfield.0"]' '0: u32' // @has - '//*[@id="structfield.0"]' '0: u32'
// @has - '//*[@id="main"]/div[@class="docblock"]' 'hello' // @has - '//*[@id="main-content"]/div[@class="docblock"]' 'hello'
// @!has - '//*[@id="structfield.1"]' // @!has - '//*[@id="structfield.1"]'
// @has - '//*[@id="structfield.2"]' '2: char' // @has - '//*[@id="structfield.2"]' '2: char'
// @has - '//*[@id="structfield.3"]' '3: i8' // @has - '//*[@id="structfield.3"]' '3: i8'
// @has - '//*[@id="main"]/div[@class="docblock"]' 'not hello' // @has - '//*[@id="main-content"]/div[@class="docblock"]' 'not hello'
pub struct Foo( pub struct Foo(
/// hello /// hello
pub u32, pub u32,