diff options
Diffstat (limited to '')
269 files changed, 2529 insertions, 1147 deletions
diff --git a/tests/rustdoc-gui/anchors.goml b/tests/rustdoc-gui/anchors.goml index 30b83f0da..72e0bcd77 100644 --- a/tests/rustdoc-gui/anchors.goml +++ b/tests/rustdoc-gui/anchors.goml @@ -56,7 +56,7 @@ define-function: ( assert-css: ("#top-doc-prose-title", {"color": |title_color|}) - assert-css: (".sidebar a", {"color": |sidebar_link_color|}) + assert-css: (".sidebar .block a", {"color": |sidebar_link_color|}) assert-css: (".main-heading h1 a", {"color": |title_color|}) // We move the cursor over the "Implementations" title so the anchor is displayed. diff --git a/tests/rustdoc-gui/code-tags.goml b/tests/rustdoc-gui/code-tags.goml index 3405d3295..577f932e5 100644 --- a/tests/rustdoc-gui/code-tags.goml +++ b/tests/rustdoc-gui/code-tags.goml @@ -1,6 +1,6 @@ // This test ensures that items and documentation code blocks are wrapped in <pre><code> -// We need to disable this check because `implementors/test_docs/trait.AnotherOne.js` +// We need to disable this check because `trait.impl/test_docs/trait.AnotherOne.js` // doesn't exist. fail-on-request-error: false go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" diff --git a/tests/rustdoc-gui/huge-logo.goml b/tests/rustdoc-gui/huge-logo.goml index 6d3eb6606..bfc24c326 100644 --- a/tests/rustdoc-gui/huge-logo.goml +++ b/tests/rustdoc-gui/huge-logo.goml @@ -4,8 +4,8 @@ go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html" set-window-size: (1280, 1024) // offsetWidth = width of sidebar -assert-property: (".sidebar .logo-container", {"offsetWidth": "200", "offsetHeight": 100}) -assert-property: (".sidebar .logo-container img", {"offsetWidth": "100", "offsetHeight": 100}) +assert-property: (".sidebar-crate .logo-container", {"offsetWidth": "48", "offsetHeight": 48}) +assert-property: (".sidebar-crate .logo-container img", {"offsetWidth": "48", "offsetHeight": 48}) set-window-size: (400, 600) // offset = size + margin diff --git a/tests/rustdoc-gui/impl_on_foreign_order.goml b/tests/rustdoc-gui/impl_on_foreign_order.goml new file mode 100644 index 000000000..a6f5343be --- /dev/null +++ b/tests/rustdoc-gui/impl_on_foreign_order.goml @@ -0,0 +1,6 @@ +// This test ensures that the "implementations on foreign types" of a trait are correctly sorted. +go-to: "file://" + |DOC_PATH| + "/test_docs/foreign_impl_order/trait.Foo.html" +assert-text: ("details:nth-of-type(1) h3", "impl Foo<1> for [u8; 1]") +assert-text: ("details:nth-of-type(2) h3", "impl Foo<2> for [u8; 2]") +assert-text: ("details:nth-of-type(3) h3", "impl Foo<3> for [u8; 3]") +assert-text: ("details:nth-of-type(4) h3", "impl Foo<4> for [u8; 4]") diff --git a/tests/rustdoc-gui/item-decl-colors.goml b/tests/rustdoc-gui/item-decl-colors.goml index a77784273..7bbd20c4e 100644 --- a/tests/rustdoc-gui/item-decl-colors.goml +++ b/tests/rustdoc-gui/item-decl-colors.goml @@ -1,6 +1,6 @@ // This test ensures that the color of the items in the type decl are working as expected. -// We need to disable this check because `implementors/test_docs/trait.TraitWithoutGenerics.js` +// We need to disable this check because `trait.impl/test_docs/trait.TraitWithoutGenerics.js` // doesn't exist. fail-on-request-error: false diff --git a/tests/rustdoc-gui/no-docblock.goml b/tests/rustdoc-gui/no-docblock.goml index 1b4638ef0..2115b6f53 100644 --- a/tests/rustdoc-gui/no-docblock.goml +++ b/tests/rustdoc-gui/no-docblock.goml @@ -1,6 +1,6 @@ // This test checks that there are margins applied to methods with no docblocks. -// We need to disable this check because `implementors/test_docs/trait.TraitWithNoDocblock.js` +// We need to disable this check because `trait.impl/test_docs/trait.TraitWithNoDocblock.js` // doesn't exist. fail-on-request-error: false diff --git a/tests/rustdoc-gui/rust-logo.goml b/tests/rustdoc-gui/rust-logo.goml index cd453aea2..696cab34d 100644 --- a/tests/rustdoc-gui/rust-logo.goml +++ b/tests/rustdoc-gui/rust-logo.goml @@ -1,18 +1,18 @@ // This test ensures that the correct style is applied to the rust logo in the sidebar. -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/staged_api/index.html" define-function: ( "check-logo", (theme, filter), block { // Going to the doc page. - go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" + go-to: "file://" + |DOC_PATH| + "/staged_api/index.html" // Changing theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".rust-logo", {"filter": |filter|}) // Going to the source code page. - go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" + go-to: "file://" + |DOC_PATH| + "/src/staged_api/lib.rs.html" // Changing theme (since it's local files, the local storage works by folder). set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: @@ -26,6 +26,15 @@ define-function: ( assert-false: ".rust-logo" // Check there is no filter. assert-css: (".sidebar .logo-container img", {"filter": "none"}) + // Now we check that this page has no logo at all + go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" + assert-false: ".rust-logo" + assert-false: ".logo-container" + assert-false: ".sub-logo-container" + go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" + assert-false: ".rust-logo" + assert-false: ".logo-container" + assert-false: ".sub-logo-container" }, ) diff --git a/tests/rustdoc-gui/search-result-impl-disambiguation.goml b/tests/rustdoc-gui/search-result-impl-disambiguation.goml new file mode 100644 index 000000000..6d12032e8 --- /dev/null +++ b/tests/rustdoc-gui/search-result-impl-disambiguation.goml @@ -0,0 +1,43 @@ +// ignore-tidy-linelength + +// Checks that, if a type has two methods with the same name, they both get +// linked correctly. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" + +// This should link to the inherent impl +write: (".search-input", "ZyxwvutMethodDisambiguation -> bool") +// To be SURE that the search will be run. +press-key: 'Enter' +// Waiting for the search results to appear... +wait-for: "#search-tabs" +// Check the disambiguated link. +assert-count: ("a.result-method", 1) +assert-attribute: ("a.result-method", { + "href": "../test_docs/struct.ZyxwvutMethodDisambiguation.html#impl-ZyxwvutMethodDisambiguation/method.method_impl_disambiguation" +}) +click: "a.result-method" +wait-for: "#impl-ZyxwvutMethodDisambiguation" +assert-document-property: ({ + "URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation" +}, ENDS_WITH) +assert: "section:target" + +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" + +// This should link to the trait impl +write: (".search-input", "ZyxwvutMethodDisambiguation, usize -> usize") +// To be SURE that the search will be run. +press-key: 'Enter' +// Waiting for the search results to appear... +wait-for: "#search-tabs" +// Check the disambiguated link. +assert-count: ("a.result-method", 1) +assert-attribute: ("a.result-method", { + "href": "../test_docs/struct.ZyxwvutMethodDisambiguation.html#impl-ZyxwvutTrait-for-ZyxwvutMethodDisambiguation/method.method_impl_disambiguation" +}) +click: "a.result-method" +wait-for: "#impl-ZyxwvutMethodDisambiguation" +assert-document-property: ({ + "URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation-1" +}, ENDS_WITH) +assert: "section:target" diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml index 427201e1b..db1605ff2 100644 --- a/tests/rustdoc-gui/search-tab.goml +++ b/tests/rustdoc-gui/search-tab.goml @@ -79,8 +79,8 @@ call-function: ("check-colors", { set-window-size: (851, 600) // Check the size and count in tabs -assert-text: ("#search-tabs > button:nth-child(1) > .count", " (23) ") -assert-text: ("#search-tabs > button:nth-child(2) > .count", " (4) ") +assert-text: ("#search-tabs > button:nth-child(1) > .count", " (25) ") +assert-text: ("#search-tabs > button:nth-child(2) > .count", " (5) ") assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0) ") store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth}) assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|}) diff --git a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml index 6cd725043..b55a1cfd9 100644 --- a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml +++ b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml @@ -1,7 +1,7 @@ // This test ensures that the "Auto-hide item contents for large items" setting is working as // expected. -// We need to disable this check because `implementors/test_docs/trait.Iterator.js` doesn't exist. +// We need to disable this check because `trait.impl/test_docs/trait.Iterator.js` doesn't exist. fail-on-request-error: false define-function: ( diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml index 4b8337ace..d3a82d9eb 100644 --- a/tests/rustdoc-gui/sidebar-mobile.goml +++ b/tests/rustdoc-gui/sidebar-mobile.goml @@ -26,7 +26,7 @@ assert-css: (".sidebar", {"left": "0px"}) // Make sure the "struct Foo" header is hidden, since the mobile topbar already does it. assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='Foo']/parent::h2", {"display": "none"}) // Make sure the global navigation is still here. -assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='In test_docs']/parent::h2", {"display": "block"}) +assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='In crate test_docs']/parent::h2", {"display": "block"}) // Click elsewhere. click: "body" @@ -50,7 +50,7 @@ assert-position: ("#method\.must_use", {"y": 46}) // Check that the bottom-most item on the sidebar menu can be scrolled fully into view. click: ".sidebar-menu-toggle" scroll-to: ".block.keyword li:nth-child(1)" -compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 543.19}) +compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 544}) // Now checking the background color of the sidebar. show-text: true diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml index 88546ed25..cea4db146 100644 --- a/tests/rustdoc-gui/sidebar-source-code-display.goml +++ b/tests/rustdoc-gui/sidebar-source-code-display.goml @@ -174,14 +174,14 @@ click: "#src-sidebar-toggle" wait-for-css: (".sidebar", {"left": "-1000px"}) // We scroll to line 117 to change the scroll position. scroll-to: '//*[@id="117"]' -assert-window-property: {"pageYOffset": "2542"} +assert-window-property: {"pageYOffset": "2516"} // Expanding the sidebar... click: "#src-sidebar-toggle" wait-for-css: (".sidebar", {"left": "0px"}) click: "#src-sidebar-toggle" wait-for-css: (".sidebar", {"left": "-1000px"}) // The "scrollTop" property should be the same. -assert-window-property: {"pageYOffset": "2542"} +assert-window-property: {"pageYOffset": "2516"} // We now check that opening the sidebar and clicking a link will close it. // The behavior here on mobile is different than the behavior on desktop, diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml index 520481d3b..eff66d803 100644 --- a/tests/rustdoc-gui/sidebar.goml +++ b/tests/rustdoc-gui/sidebar.goml @@ -50,9 +50,9 @@ set-local-storage: {"rustdoc-theme": "light"} // We reload the page so the local storage settings are being used. reload: -assert-text: (".sidebar > .location", "Crate test_docs") -// In modules, we only have one "location" element. -assert-count: (".sidebar .location", 1) +assert-text: (".sidebar > .sidebar-crate > h2 > a", "test_docs") +// Crate root has no "location" element +assert-count: (".sidebar .location", 0) assert-count: (".sidebar h2", 1) assert-text: ("#all-types", "All Items") assert-css: ("#all-types", {"color": "#356da4"}) @@ -74,8 +74,9 @@ assert-text: ("#structs + .item-table .item-name > a", "Foo") click: "#structs + .item-table .item-name > a" // PAGE: struct.Foo.html +assert-count: (".sidebar .sidebar-crate", 1) assert-count: (".sidebar .location", 1) -assert-count: (".sidebar h2", 2) +assert-count: (".sidebar h2", 3) // We check that there is no crate listed outside of the top level. assert-false: ".sidebar-elems > .crate" @@ -94,7 +95,8 @@ click: ".sidebar-elems ul.crate > li:first-child > a" // PAGE: lib2/index.html go-to: "file://" + |DOC_PATH| + "/lib2/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) -assert-text: (".sidebar > .location", "Crate lib2") +assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2") +assert-count: (".sidebar .location", 0) // We check that we have the crates list and that the "current" on is now "lib2". assert-text: (".sidebar-elems ul.crate > li > a.current", "lib2") // We now go to the "foobar" function page. @@ -108,22 +110,39 @@ click: "#functions + .item-table .item-name > a" // PAGE: fn.foobar.html // In items containing no items (like functions or constants) and in modules, we have no -// "location" elements. Only the parent module h2. +// "location" elements. Only the crate and optional parent module. +// This page, being directly below the crate, only has its heading. +assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2") assert-count: (".sidebar .location", 0) assert-count: (".sidebar h2", 1) -assert-text: (".sidebar .sidebar-elems h2", "In lib2") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" go-to: "./module/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) +assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2") assert-text: (".sidebar > .location", "Module module") +assert-count: (".sidebar .location", 1) +// Module page requires three headings: +// - Presistent crate branding (name and version) +// - Module name, followed by TOC for module headings +// - "In crate [name]" parent pointer, followed by sibling navigation +assert-count: (".sidebar h2", 3) +assert-text: (".sidebar > .sidebar-elems > h2", "In crate lib2") +assert-property: (".sidebar > .sidebar-elems > h2 > a", { + "href": "/lib2/index.html", +}, ENDS_WITH) // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" go-to: "./sub_module/sub_sub_module/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) +assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2") assert-text: (".sidebar > .location", "Module sub_sub_module") +assert-text: (".sidebar > .sidebar-elems > h2", "In lib2::module::sub_module") +assert-property: (".sidebar > .sidebar-elems > h2 > a", { + "href": "/module/sub_module/index.html", +}, ENDS_WITH) // We check that we don't have the crate list. assert-false: ".sidebar-elems .crate" assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions") @@ -152,14 +171,14 @@ assert-property: (".sidebar", {"clientWidth": "200"}) // Checks that all.html and index.html have their sidebar link in the same place. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -store-property: (".sidebar .location a", { +store-property: (".sidebar .sidebar-crate h2 a", { "clientWidth": index_sidebar_width, "clientHeight": index_sidebar_height, "offsetTop": index_sidebar_y, "offsetLeft": index_sidebar_x, }) go-to: "file://" + |DOC_PATH| + "/test_docs/all.html" -assert-property: (".sidebar .location a", { +assert-property: (".sidebar .sidebar-crate h2 a", { "clientWidth": |index_sidebar_width|, "clientHeight": |index_sidebar_height|, "offsetTop": |index_sidebar_y|, diff --git a/tests/rustdoc-gui/source-anchor-scroll.goml b/tests/rustdoc-gui/source-anchor-scroll.goml index 0e4913caf..940851ea1 100644 --- a/tests/rustdoc-gui/source-anchor-scroll.goml +++ b/tests/rustdoc-gui/source-anchor-scroll.goml @@ -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": "149"}) +assert-property: ("html", {"scrollTop": "123"}) click: '//a[text() = "bar" and @href="#28-36"]' -assert-property: ("html", {"scrollTop": "180"}) +assert-property: ("html", {"scrollTop": "154"}) click: '//a[text() = "sub_fn" and @href="#2-4"]' -assert-property: ("html", {"scrollTop": "77"}) +assert-property: ("html", {"scrollTop": "51"}) // 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": "77"}) +assert-property: ("html", {"scrollTop": "51"}) diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index f19e3ce80..ad57380ae 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -89,9 +89,9 @@ 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": 112}) +assert-position: ("//*[@id='1']", {"x": 88, "y": 86}) // We click on the left of the "1" anchor but still in the "src-line-number" `<pre>`. -click: (87, 103) +click: (87, 77) assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH) // Checking the source code sidebar. @@ -163,16 +163,16 @@ assert-css: ("nav.sub", {"flex-direction": "row"}) // 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": 28, "offsetHeight": 34}) -assert-property: ("#main-content", {"offsetTop": 90}) -// 28 = 90 - 34 - 28 +assert-property: ("nav.sub form", {"offsetTop": 15, "offsetHeight": 34}) +assert-property: ("#main-content", {"offsetTop": 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": 21, "offsetHeight": 34}) -assert-property: ("#main-content", {"offsetTop": 76}) -// 21 = 76 - 34 - 21 +assert-property: ("nav.sub form", {"offsetTop": 8, "offsetHeight": 34}) +assert-property: ("#main-content", {"offsetTop": 50}) +// 8 = 50 - 34 - 8 // Check the sidebar directory entries have a marker and spacing (tablet). store-property: ("#src-sidebar > .title", { @@ -198,7 +198,12 @@ call-function: ("check-sidebar-dir-entry", { "y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6, }) +// The logo is not present on this page. +assert-false: ".sub-logo-container > img" + +// Check the staged-api page instead, which does. // Now we check that the logo has a bottom margin so it's not stuck to the search input. +go-to: "file://" + |DOC_PATH| + "/src/staged_api/lib.rs.html" assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"}) store-property: (".sub-logo-container", {"clientHeight": logo_height}) assert-position: (".search-form", {"y": |logo_height| + 8}) diff --git a/tests/rustdoc-gui/src/lib2/lib.rs b/tests/rustdoc-gui/src/lib2/lib.rs index 34e67d9d2..a2a3c3187 100644 --- a/tests/rustdoc-gui/src/lib2/lib.rs +++ b/tests/rustdoc-gui/src/lib2/lib.rs @@ -147,13 +147,13 @@ pub struct LongItemInfo2; #[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))] impl SimpleTrait for LongItemInfo2 {} -pub struct WhereWhitespace<T>; +pub struct WhereWhitespace<T>(T); impl<T> WhereWhitespace<T> { pub fn new<F>(f: F) -> Self where F: FnMut() -> i32, - {} + {todo!()} } impl<K, T> Whitespace<&K> for WhereWhitespace<T> @@ -187,6 +187,11 @@ impl ItemInfoAlignmentTest { pub mod scroll_traits { use std::iter::*; + struct Intersperse<T>(T); + struct IntersperseWith<T, U>(T, U); + struct Flatten<T>(T); + struct Peekable<T>(T); + /// Shamelessly (partially) copied from `std::iter::Iterator`. /// It allows us to check that the scroll is working as expected on "hidden" items. pub trait Iterator { diff --git a/tests/rustdoc-gui/src/staged_api/lib.rs b/tests/rustdoc-gui/src/staged_api/lib.rs index 0c914470e..9b5ad1c5f 100644 --- a/tests/rustdoc-gui/src/staged_api/lib.rs +++ b/tests/rustdoc-gui/src/staged_api/lib.rs @@ -1,6 +1,8 @@ #![feature(staged_api)] +#![feature(rustdoc_internals)] #![allow(internal_features)] #![stable(feature = "some_feature", since = "1.3.5")] +#![doc(rust_logo)] #[stable(feature = "some_feature", since = "1.3.5")] pub struct Foo {} diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index 38180aef7..c7d115bdb 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -160,6 +160,33 @@ pub mod keyword {} /// Just some type alias. pub type SomeType = u32; +/// Another type alias, this time with methods. +pub type SomeOtherTypeWithMethodsAndInlining = Foo; + +impl SomeOtherTypeWithMethodsAndInlining { + pub fn some_other_method_directly(&self) {} +} + +/// Another type alias, this time with methods. +pub struct UnderlyingFooBarBaz; +pub type SomeOtherTypeWithMethodsAndInliningAndTraits = UnderlyingFooBarBaz; + +impl AsRef<str> for UnderlyingFooBarBaz { + fn as_ref(&self) -> &str { + "hello" + } +} + +impl UnderlyingFooBarBaz { + pub fn inherent_fn(&self) {} +} + +impl AsRef<u8> for SomeOtherTypeWithMethodsAndInliningAndTraits { + fn as_ref(&self) -> &u8 { + b"hello" + } +} + pub mod huge_amount_of_consts { include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs")); } @@ -529,3 +556,40 @@ pub mod cfgs { /// Some docs. pub mod cfgs {} } + +pub struct ZyxwvutMethodDisambiguation; + +impl ZyxwvutMethodDisambiguation { + pub fn method_impl_disambiguation(&self) -> bool { + true + } +} + +pub trait ZyxwvutTrait { + fn method_impl_disambiguation(&self, x: usize) -> usize; +} + +impl ZyxwvutTrait for ZyxwvutMethodDisambiguation { + fn method_impl_disambiguation(&self, x: usize) -> usize { + x + } +} + +pub mod foreign_impl_order { + pub trait Foo<const W: usize> { + fn f(&mut self, with: [u8; W]); + } + + impl Foo<4> for [u8; 4] { + fn f(&mut self, fg: [u8; 4]) {} + } + impl Foo<2> for [u8; 2] { + fn f(&mut self, fg: [u8; 2]) {} + } + impl Foo<1> for [u8; 1] { + fn f(&mut self, fg: [u8; 1]) {} + } + impl Foo<3> for [u8; 3] { + fn f(&mut self, fg: [u8; 3]) {} + } +} diff --git a/tests/rustdoc-gui/trait-sidebar-item-order.goml b/tests/rustdoc-gui/trait-sidebar-item-order.goml index 9330ef040..73e362ca8 100644 --- a/tests/rustdoc-gui/trait-sidebar-item-order.goml +++ b/tests/rustdoc-gui/trait-sidebar-item-order.goml @@ -1,6 +1,6 @@ // Checks that the elements in the sidebar are alphabetically sorted. -// We need to disable this check because `implementors/test_docs/trait.AnotherOne.js` +// We need to disable this check because `trait.impl/test_docs/trait.AnotherOne.js` // doesn't exist. fail-on-request-error: false diff --git a/tests/rustdoc-gui/type-declation-overflow.goml b/tests/rustdoc-gui/type-declation-overflow.goml index f212781e9..5780f5c88 100644 --- a/tests/rustdoc-gui/type-declation-overflow.goml +++ b/tests/rustdoc-gui/type-declation-overflow.goml @@ -2,7 +2,7 @@ // This test ensures that the items declaration content overflow is handled inside the <pre> directly. // We need to disable this check because -// `implementors/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js` +// `trait.impl/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js` // doesn't exist. fail-on-request-error: false diff --git a/tests/rustdoc-gui/type-impls.goml b/tests/rustdoc-gui/type-impls.goml new file mode 100644 index 000000000..870a9cbe5 --- /dev/null +++ b/tests/rustdoc-gui/type-impls.goml @@ -0,0 +1,86 @@ +// The goal of this test is to check that the inlined type alias impls, generated with JS, +// have the same display than the "local" ones. +go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeOtherTypeWithMethodsAndInlining.html" + +// method directly on type alias +wait-for: "//*[@id='method.some_other_method_directly']" + +// methods on foo +assert: "//*[@id='method.as_ref']" +assert: "//*[@id='method.must_use']" +assert: "//*[@id='method.warning1']" +assert: "//*[@id='method.warning2']" + +// sidebar items +assert: "//*[@class='sidebar-elems']//li/a[@href='#method.must_use']" +assert: "//*[@class='sidebar-elems']//li/a[@href='#method.some_other_method_directly']" +assert: "//*[@class='sidebar-elems']//li/a[@href='#method.warning1']" +assert: "//*[@class='sidebar-elems']//li/a[@href='#method.warning2']" +assert: "//*[@class='sidebar-elems']//li/a[@href='#impl-AsRef%3Cstr%3E-for-Foo']" + +// sorting +assert-text: (".block.method li:nth-child(1)", 'must_use') +assert-text: (".block.method li:nth-child(2)", 'some_other_method_directly') +assert-text: (".block.method li:nth-child(3)", 'warning1') +assert-text: (".block.method li:nth-child(4)", 'warning2') + +// Now try trait implementation merging and duplicate renumbering +go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeOtherTypeWithMethodsAndInliningAndTraits.html" + +// method directly on type alias +assert: "//*[@id='method.as_ref']" +assert-count: ("//*[@id='method.as_ref']", 1) +// method on underlying type +assert: "//*[@id='method.as_ref-1']" + +// sidebar items +assert-count: ( + "//*[@class='sidebar-elems']//h3/a[@href='#trait-implementations']", + 1 +) +assert-text: ("//*[@class='sidebar-elems']//li/a[@href='#impl-AsRef%3Cstr%3E-for-UnderlyingFooBarBaz']", "AsRef<str>") +assert-text: ( + "//*[@class='sidebar-elems']//li/a[@href='#impl-AsRef%3Cu8%3E-for-UnderlyingFooBarBaz']", + "AsRef<u8>" +) +assert-count: ("#trait-implementations-list", 1) +assert-count: ("#trait-implementations-list > details", 2) +// Both links point at the underlying trait +store-property: ("//*[@id='method.as_ref']//a[@class='fn']", {"href": href}) +assert-property: ("//*[@id='method.as_ref-1']//a[@class='fn']", {"href": |href|}) +// Both links have a self-anchor +assert: "//*[@id='method.as_ref']//a[@class='anchor'][@href='#method.as_ref']" +assert: "//*[@id='method.as_ref-1']//a[@class='anchor'][@href='#method.as_ref-1']" + +/////////////////////////////////////////////////////////////////////////// +// Now, if JavaScript is disabled, only the first method will be present // +/////////////////////////////////////////////////////////////////////////// +javascript: false +go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeOtherTypeWithMethodsAndInlining.html" + +// method directly on type alias +wait-for: "//*[@id='method.some_other_method_directly']" + +// methods on foo +assert-false: "//*[@id='method.must_use']" +assert-false: "//*[@id='method.warning1']" +assert-false: "//*[@id='method.warning2']" + +// Now try trait implementation merging and duplicate renumbering +go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeOtherTypeWithMethodsAndInliningAndTraits.html" + +// methods directly on type alias +assert: "//*[@id='method.as_ref']" +assert-count: ("//*[@id='method.as_ref']", 1) +// method on target type +assert-false: "//*[@id='method.as_ref-1']" + +// sidebar items +assert-count: ( + "//*[@class='sidebar-elems']//h3/a[@href='#trait-implementations']", + 1 +) +assert-false: "//a[@href='#impl-AsRef%3Cstr%3E-for-UnderlyingFooBarBaz']" +assert: "//a[@href='#impl-AsRef%3Cu8%3E-for-UnderlyingFooBarBaz']" +assert-count: ("#trait-implementations-list", 1) +assert-count: ("#trait-implementations-list > details", 1) diff --git a/tests/rustdoc-js-std/simd-type-signatures.js b/tests/rustdoc-js-std/simd-type-signatures.js new file mode 100644 index 000000000..5c7cf372b --- /dev/null +++ b/tests/rustdoc-js-std/simd-type-signatures.js @@ -0,0 +1,70 @@ +// exact-check +// ignore-order +// ignore-tidy-linelength + +// This test case verifies that the href points at the correct impl + +const FILTER_CRATE = "std"; + +const EXPECTED = [ + { + 'query': 'simd<i16>, simd<i16> -> simd<i16>', + 'others': [ + { + 'path': 'std::simd::prelude::Simd', + 'name': 'simd_max', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_max' + }, + { + 'path': 'std::simd::prelude::Simd', + 'name': 'simd_min', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_min' + }, + { + 'path': 'std::simd::prelude::Simd', + 'name': 'simd_clamp', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_clamp' + }, + { + 'path': 'std::simd::prelude::Simd', + 'name': 'saturating_add', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci16,+LANES%3E/method.saturating_add' + }, + { + 'path': 'std::simd::prelude::Simd', + 'name': 'saturating_sub', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci16,+LANES%3E/method.saturating_sub' + }, + ], + }, + { + 'query': 'simd<i8>, simd<i8> -> simd<i8>', + 'others': [ + { + 'path': 'std::simd::prelude::Simd', + 'name': 'simd_max', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_max' + }, + { + 'path': 'std::simd::prelude::Simd', + 'name': 'simd_min', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_min' + }, + { + 'path': 'std::simd::prelude::Simd', + 'name': 'simd_clamp', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_clamp' + }, + { + 'path': 'std::simd::prelude::Simd', + 'name': 'saturating_add', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci8,+LANES%3E/method.saturating_add' + }, + { + 'path': 'std::simd::prelude::Simd', + 'name': 'saturating_sub', + 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci8,+LANES%3E/method.saturating_sub' + }, + ], + }, +]; diff --git a/tests/rustdoc-js/auxiliary/equivalent.rs b/tests/rustdoc-js/auxiliary/equivalent.rs new file mode 100644 index 000000000..a19b5a2d4 --- /dev/null +++ b/tests/rustdoc-js/auxiliary/equivalent.rs @@ -0,0 +1,15 @@ +use std::borrow::Borrow; + +pub trait Equivalent<K: ?Sized> { + fn equivalent(&self, key: &K) -> bool; +} + +impl<Q: ?Sized, K: ?Sized> Equivalent<K> for Q +where + Q: Eq, + K: Borrow<Q>, +{ + fn equivalent(&self, key: &K) -> bool { + PartialEq::eq(self, key.borrow()) + } +} diff --git a/tests/rustdoc-js/impl-trait.js b/tests/rustdoc-js/impl-trait.js index 710e594b5..00d67d639 100644 --- a/tests/rustdoc-js/impl-trait.js +++ b/tests/rustdoc-js/impl-trait.js @@ -1,3 +1,4 @@ +// exact-check // ignore-order const EXPECTED = [ @@ -20,9 +21,16 @@ const EXPECTED = [ { 'query': '-> Aaaaaaa', 'others': [ - { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, - { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' }, { 'path': 'impl_trait', 'name': 'bbbbbbb' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' }, + ], + }, + { + 'query': '-> Bbbbbbb', + 'others': [ + { 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' }, ], }, { @@ -31,13 +39,14 @@ const EXPECTED = [ { 'path': 'impl_trait', 'name': 'Aaaaaaa' }, ], 'in_args': [ - { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, { 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, ], 'returned': [ - { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, - { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' }, { 'path': 'impl_trait', 'name': 'bbbbbbb' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' }, ], }, ]; diff --git a/tests/rustdoc-js/impl-trait.rs b/tests/rustdoc-js/impl-trait.rs index fb8869b46..d20fdd60e 100644 --- a/tests/rustdoc-js/impl-trait.rs +++ b/tests/rustdoc-js/impl-trait.rs @@ -1,6 +1,9 @@ pub trait Aaaaaaa {} +pub trait Bbbbbbb {} + impl Aaaaaaa for () {} +impl Bbbbbbb for () {} pub fn bbbbbbb() -> impl Aaaaaaa { () @@ -18,4 +21,7 @@ impl Ccccccc { pub fn fffffff(&self, x: impl Aaaaaaa) -> impl Aaaaaaa { x } + pub fn ggggggg(&self) -> impl Aaaaaaa + Bbbbbbb { + () + } } diff --git a/tests/rustdoc-js/search-method-disambiguate.js b/tests/rustdoc-js/search-method-disambiguate.js new file mode 100644 index 000000000..70aa895f9 --- /dev/null +++ b/tests/rustdoc-js/search-method-disambiguate.js @@ -0,0 +1,28 @@ +// exact-check +// ignore-order +// ignore-tidy-linelength + +const FILTER_CRATE = "search_method_disambiguate"; + +const EXPECTED = [ + { + 'query': 'MyTy -> bool', + 'others': [ + { + 'path': 'search_method_disambiguate::MyTy', + 'name': 'my_method', + 'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cbool%3E/method.my_method' + }, + ], + }, + { + 'query': 'MyTy -> u8', + 'others': [ + { + 'path': 'search_method_disambiguate::MyTy', + 'name': 'my_method', + 'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cu8%3E/method.my_method' + }, + ], + } +]; diff --git a/tests/rustdoc-js/search-method-disambiguate.rs b/tests/rustdoc-js/search-method-disambiguate.rs new file mode 100644 index 000000000..ae884447a --- /dev/null +++ b/tests/rustdoc-js/search-method-disambiguate.rs @@ -0,0 +1,22 @@ +pub trait X { + type InnerType; + fn my_method(&self) -> Self::InnerType; +} + +pub struct MyTy<T> { + pub t: T, +} + +impl X for MyTy<bool> { + type InnerType = bool; + fn my_method(&self) -> bool { + self.t + } +} + +impl X for MyTy<u8> { + type InnerType = u8; + fn my_method(&self) -> u8 { + self.t + } +} diff --git a/tests/rustdoc-js/search-non-local-trait-impl.js b/tests/rustdoc-js/search-non-local-trait-impl.js new file mode 100644 index 000000000..9ebeceb69 --- /dev/null +++ b/tests/rustdoc-js/search-non-local-trait-impl.js @@ -0,0 +1,9 @@ +// exact-check + +// This test ensures that methods from blanket impls of not available foreign traits +// don't show up in the search results. + +const EXPECTED = { + 'query': 'equivalent', + 'others': [], +}; diff --git a/tests/rustdoc-js/search-non-local-trait-impl.rs b/tests/rustdoc-js/search-non-local-trait-impl.rs new file mode 100644 index 000000000..462b75b0b --- /dev/null +++ b/tests/rustdoc-js/search-non-local-trait-impl.rs @@ -0,0 +1,8 @@ +// aux-crate:priv:equivalent=equivalent.rs +// compile-flags: -Zunstable-options --extern equivalent +// edition:2018 + +extern crate equivalent; + +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct LayoutError; diff --git a/tests/rustdoc-json/doc_hidden_failure.rs b/tests/rustdoc-json/doc_hidden_failure.rs index 0d2c6b220..e2ce66c99 100644 --- a/tests/rustdoc-json/doc_hidden_failure.rs +++ b/tests/rustdoc-json/doc_hidden_failure.rs @@ -1,8 +1,5 @@ // Regression test for <https://github.com/rust-lang/rust/issues/98007>. -#![feature(no_core)] -#![no_core] - mod auto { mod action_row { pub struct ActionRowBuilder; diff --git a/tests/rustdoc-json/enums/field_hidden.rs b/tests/rustdoc-json/enums/field_hidden.rs index 5c0d0ffd3..74d96248d 100644 --- a/tests/rustdoc-json/enums/field_hidden.rs +++ b/tests/rustdoc-json/enums/field_hidden.rs @@ -1,8 +1,5 @@ // Regression test for <https://github.com/rust-lang/rust/issues/100529>. -#![no_core] -#![feature(no_core)] - // @has "$.index[*][?(@.name=='ParseError')]" // @has "$.index[*][?(@.name=='UnexpectedEndTag')]" // @is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null] diff --git a/tests/rustdoc-json/enums/kind.rs b/tests/rustdoc-json/enums/kind.rs index e283c0740..684836834 100644 --- a/tests/rustdoc-json/enums/kind.rs +++ b/tests/rustdoc-json/enums/kind.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - pub enum Foo { // @set Unit = "$.index[*][?(@.name=='Unit')].id" // @is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"' diff --git a/tests/rustdoc-json/enums/tuple_fields_hidden.rs b/tests/rustdoc-json/enums/tuple_fields_hidden.rs index 3aeb03564..53cdf83ff 100644 --- a/tests/rustdoc-json/enums/tuple_fields_hidden.rs +++ b/tests/rustdoc-json/enums/tuple_fields_hidden.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - // @set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id" // @set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id" // @set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id" diff --git a/tests/rustdoc-json/enums/use_glob.rs b/tests/rustdoc-json/enums/use_glob.rs index 49990ec53..bec89530b 100644 --- a/tests/rustdoc-json/enums/use_glob.rs +++ b/tests/rustdoc-json/enums/use_glob.rs @@ -1,8 +1,5 @@ // Regression test for <https://github.com/rust-lang/rust/issues/104942> -#![feature(no_core)] -#![no_core] - // @set Color = "$.index[*][?(@.name == 'Color')].id" pub enum Color { Red, diff --git a/tests/rustdoc-json/enums/use_variant.rs b/tests/rustdoc-json/enums/use_variant.rs index 8190e1cbe..c7e0c21f1 100644 --- a/tests/rustdoc-json/enums/use_variant.rs +++ b/tests/rustdoc-json/enums/use_variant.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - // @set AlwaysNone = "$.index[*][?(@.name == 'AlwaysNone')].id" pub enum AlwaysNone { // @set None = "$.index[*][?(@.name == 'None')].id" diff --git a/tests/rustdoc-json/fn_pointer/generics.rs b/tests/rustdoc-json/fn_pointer/generics.rs index 3b82561ec..8b3a8c0a7 100644 --- a/tests/rustdoc-json/fn_pointer/generics.rs +++ b/tests/rustdoc-json/fn_pointer/generics.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - // @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1 // @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[0][0]" '"val"' // @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[0][1].borrowed_ref.lifetime" \"\'c\" diff --git a/tests/rustdoc-json/fns/extern_c_variadic.rs b/tests/rustdoc-json/fns/extern_c_variadic.rs index d6ea343b9..eef9ae99e 100644 --- a/tests/rustdoc-json/fns/extern_c_variadic.rs +++ b/tests/rustdoc-json/fns/extern_c_variadic.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - extern "C" { // @is "$.index[*][?(@.name == 'not_variadic')].inner.function.decl.c_variadic" false pub fn not_variadic(_: i32); diff --git a/tests/rustdoc-json/fns/generic_args.rs b/tests/rustdoc-json/fns/generic_args.rs index 539d17f83..2f6cf3bf6 100644 --- a/tests/rustdoc-json/fns/generic_args.rs +++ b/tests/rustdoc-json/fns/generic_args.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - // @set foo = "$.index[*][?(@.name=='Foo')].id" pub trait Foo {} diff --git a/tests/rustdoc-json/fns/generic_returns.rs b/tests/rustdoc-json/fns/generic_returns.rs index 27d842066..8e82efef4 100644 --- a/tests/rustdoc-json/fns/generic_returns.rs +++ b/tests/rustdoc-json/fns/generic_returns.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - // @count "$.index[*][?(@.name=='generic_returns')].inner.module.items[*]" 2 // @set foo = "$.index[*][?(@.name=='Foo')].id" diff --git a/tests/rustdoc-json/fns/generics.rs b/tests/rustdoc-json/fns/generics.rs index 5239a6f21..44dc6d854 100644 --- a/tests/rustdoc-json/fns/generics.rs +++ b/tests/rustdoc-json/fns/generics.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - // @set wham_id = "$.index[*][?(@.name=='Wham')].id" pub trait Wham {} diff --git a/tests/rustdoc-json/generic-associated-types/gats.rs b/tests/rustdoc-json/generic-associated-types/gats.rs index 99c57ff65..56d6e7a49 100644 --- a/tests/rustdoc-json/generic-associated-types/gats.rs +++ b/tests/rustdoc-json/generic-associated-types/gats.rs @@ -1,11 +1,5 @@ // ignore-tidy-linelength -#![no_core] -#![feature(lang_items, no_core)] - -#[lang = "sized"] -pub trait Sized {} - pub trait Display {} pub trait LendingIterator { diff --git a/tests/rustdoc-json/glob_import.rs b/tests/rustdoc-json/glob_import.rs index f37ce0abb..7de1ed78f 100644 --- a/tests/rustdoc-json/glob_import.rs +++ b/tests/rustdoc-json/glob_import.rs @@ -1,13 +1,10 @@ // This is a regression test for <https://github.com/rust-lang/rust/issues/98003>. -#![feature(no_core)] #![no_std] -#![no_core] // @has "$.index[*][?(@.name=='glob')]" // @has "$.index[*][?(@.inner.import)].inner.import.name" \"*\" - mod m1 { pub fn f() {} } diff --git a/tests/rustdoc-json/impls/auto.rs b/tests/rustdoc-json/impls/auto.rs index ace37e5b3..96c3ab08b 100644 --- a/tests/rustdoc-json/impls/auto.rs +++ b/tests/rustdoc-json/impls/auto.rs @@ -1,9 +1,12 @@ -#![feature(no_core, auto_traits, lang_items)] +#![feature(no_core, auto_traits, lang_items, arbitrary_self_types)] #![no_core] #[lang = "sized"] trait Sized {} +#[lang = "receiver"] +pub trait Receiver {} + pub auto trait Bar {} /// has span @@ -12,8 +15,8 @@ impl Foo { } // Testing spans, so all tests below code -// @is "$.index[*][?(@.docs=='has span')].span.begin" "[10, 0]" -// @is "$.index[*][?(@.docs=='has span')].span.end" "[12, 1]" +// @is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]" +// @is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]" // FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91 // is "$.index[*][?(@.inner.impl.synthetic==true)].span" null pub struct Foo; diff --git a/tests/rustdoc-json/impls/impl_item_visibility.rs b/tests/rustdoc-json/impls/impl_item_visibility.rs index efa54d91d..d3c15cd23 100644 --- a/tests/rustdoc-json/impls/impl_item_visibility.rs +++ b/tests/rustdoc-json/impls/impl_item_visibility.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - pub struct Foo; /// impl Foo priv @@ -9,18 +6,16 @@ impl Foo { } // @!has '$.index[*][?(@.docs=="impl Foo priv")]' - /// impl Foo pub impl Foo { pub fn qux() {} } // @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' - /// impl Foo hidden impl Foo { #[doc(hidden)] - pub fn __quazl(){} + pub fn __quazl() {} } // FIXME(#111564): Is this the right behaviour? // @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs index 3c6fefc4c..fa3a36df8 100644 --- a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs +++ b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs @@ -1,6 +1,4 @@ // compile-flags: --document-hidden-items -#![feature(no_core)] -#![no_core] pub struct Foo; @@ -11,18 +9,16 @@ impl Foo { // FIXME(#111564): Is this the right behaviour? // @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"' - /// impl Foo pub impl Foo { pub fn qux() {} } // @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' - /// impl Foo hidden impl Foo { #[doc(hidden)] - pub fn __quazl(){} + pub fn __quazl() {} } // FIXME(#111564): Is this the right behaviour? // @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs index b98d1e416..7c68a2412 100644 --- a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs +++ b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs @@ -1,6 +1,4 @@ // compile-flags: --document-private-items -#![feature(no_core)] -#![no_core] pub struct Foo; @@ -10,18 +8,16 @@ impl Foo { } // @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"' - /// impl Foo pub impl Foo { pub fn qux() {} } // @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' - /// impl Foo hidden impl Foo { #[doc(hidden)] - pub fn __quazl(){} + pub fn __quazl() {} } // FIXME(#111564): Is this the right behaviour? // @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' diff --git a/tests/rustdoc-json/impls/import_from_private.rs b/tests/rustdoc-json/impls/import_from_private.rs index d2b0665dc..3da03df25 100644 --- a/tests/rustdoc-json/impls/import_from_private.rs +++ b/tests/rustdoc-json/impls/import_from_private.rs @@ -1,14 +1,12 @@ // https://github.com/rust-lang/rust/issues/100252 -#![feature(no_core)] -#![no_core] - mod bar { - // @set baz = "$.index[*][?(@.inner.struct)].id" + // @set baz = "$.index[*][?(@.name == 'Baz')].id" pub struct Baz; - // @set impl = "$.index[*][?(@.inner.impl)].id" + // @set impl = "$.index[*][?(@.docs == 'impl')].id" + /// impl impl Baz { - // @set doit = "$.index[*][?(@.inner.function)].id" + // @set doit = "$.index[*][?(@.name == 'doit')].id" pub fn doit() {} } } @@ -18,5 +16,5 @@ pub use bar::Baz; // @is "$.index[*].inner.module.items[*]" $import // @is "$.index[*].inner.import.id" $baz -// @is "$.index[*].inner.struct.impls[*]" $impl -// @is "$.index[*].inner.impl.items[*]" $doit +// @has "$.index[*][?(@.name == 'Baz')].inner.struct.impls[*]" $impl +// @is "$.index[*][?(@.docs=='impl')].inner.impl.items[*]" $doit diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs index d2ac316d4..7857626d6 100644 --- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs +++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs @@ -1,7 +1,5 @@ -#![feature(no_core)] -#![no_core] - -// @count "$.index[*][?(@.inner.impl)]" 1 +// @has "$.index[*][?(@.docs=='Here')]" +// @!has "$.index[*][?(@.docs=='Not Here')]" // @!has "$.index[*][?(@.name == 'HiddenPubStruct')]" // @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]" // @has "$.index[*][?(@.name=='PubTrait')]" @@ -11,5 +9,7 @@ pub trait PubTrait {} pub struct HiddenPubStruct; pub struct NotHiddenPubStruct; +/// Not Here impl PubTrait for HiddenPubStruct {} +/// Here impl PubTrait for NotHiddenPubStruct {} diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs index fcd27ca4b..836f1fe87 100644 --- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs +++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs @@ -1,8 +1,5 @@ // compile-flags: --document-hidden-items -#![feature(no_core)] -#![no_core] - // @has "$.index[*][?(@.name == 'HiddenPubStruct')]" // @has "$.index[*][?(@.inner.impl)]" // @has "$.index[*][?(@.name=='PubTrait')]" diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs index 141c54a57..97db9c93a 100644 --- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs +++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs @@ -1,21 +1,21 @@ -#![feature(no_core)] -#![no_core] - -// @count "$.index[*][?(@.inner.impl)]" 1 -// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]" -// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]" // @has "$.index[*][?(@.name=='PubTrait')]" pub trait PubTrait {} #[doc(hidden)] pub mod hidden { + // @!has "$.index[*][?(@.name == 'HiddenPubStruct')]" pub struct HiddenPubStruct; + // @!has "$.index[*][?(@.docs == 'Not Here')]" + /// Not Here impl crate::PubTrait for HiddenPubStruct {} } pub mod not_hidden { + // @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]" pub struct NotHiddenPubStruct; + // @has "$.index[*][?(@.docs == 'Here')]" + /// Here impl crate::PubTrait for NotHiddenPubStruct {} } diff --git a/tests/rustdoc-json/impls/local_for_local.rs b/tests/rustdoc-json/impls/local_for_local.rs index 37a720003..015e89c22 100644 --- a/tests/rustdoc-json/impls/local_for_local.rs +++ b/tests/rustdoc-json/impls/local_for_local.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - // @set struct = "$.index[*][?(@.name=='Struct')].id" pub struct Struct; // @set trait = "$.index[*][?(@.name=='Trait')].id" @@ -9,7 +6,7 @@ pub trait Trait {} /// impl impl Trait for Struct {} -// @is "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl +// @has "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl // @is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl // @is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait // @is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct diff --git a/tests/rustdoc-json/impls/local_for_local_primitive.rs b/tests/rustdoc-json/impls/local_for_local_primitive.rs index 769dd3f0a..acc3a879f 100644 --- a/tests/rustdoc-json/impls/local_for_local_primitive.rs +++ b/tests/rustdoc-json/impls/local_for_local_primitive.rs @@ -1,6 +1,4 @@ -#![feature(no_core)] #![feature(rustc_attrs)] -#![no_core] // @set Local = "$.index[*][?(@.name=='Local')].id" pub trait Local {} diff --git a/tests/rustdoc-json/lifetime/longest.rs b/tests/rustdoc-json/lifetime/longest.rs index dc28258a8..419b0b4fc 100644 --- a/tests/rustdoc-json/lifetime/longest.rs +++ b/tests/rustdoc-json/lifetime/longest.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - // @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].name" \"\'a\" // @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}' // @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}' @@ -26,5 +23,9 @@ // @is "$.index[*][?(@.name=='longest')].inner.function.decl.output.borrowed_ref.type.primitive" \"str\" pub fn longest<'a>(l: &'a str, r: &'a str) -> &'a str { - if l.len() > r.len() { l } else { r } + if l.len() > r.len() { + l + } else { + r + } } diff --git a/tests/rustdoc-json/lifetime/outlives.rs b/tests/rustdoc-json/lifetime/outlives.rs index 6e105b382..549e4c200 100644 --- a/tests/rustdoc-json/lifetime/outlives.rs +++ b/tests/rustdoc-json/lifetime/outlives.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - // @count "$.index[*][?(@.name=='foo')].inner.function.generics.params[*]" 3 // @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates" [] // @is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\" diff --git a/tests/rustdoc-json/methods/abi.rs b/tests/rustdoc-json/methods/abi.rs index b8279298c..917e9e079 100644 --- a/tests/rustdoc-json/methods/abi.rs +++ b/tests/rustdoc-json/methods/abi.rs @@ -1,8 +1,6 @@ // ignore-tidy-linelength #![feature(abi_vectorcall)] -#![feature(no_core)] -#![no_core] // @has "$.index[*][?(@.name=='Foo')]" pub struct Foo; diff --git a/tests/rustdoc-json/non_lifetime_binders.rs b/tests/rustdoc-json/non_lifetime_binders.rs index cabee0b1c..d925fcd52 100644 --- a/tests/rustdoc-json/non_lifetime_binders.rs +++ b/tests/rustdoc-json/non_lifetime_binders.rs @@ -3,18 +3,9 @@ #![feature(non_lifetime_binders)] #![allow(incomplete_features)] -#![no_core] -#![feature(lang_items, no_core)] - -#[lang = "sized"] -pub trait Sized {} - pub trait Trait {} -#[lang = "phantom_data"] -struct PhantomData<T_>; - -pub struct Wrapper<T_>(PhantomData<T_>); +pub struct Wrapper<T_>(std::marker::PhantomData<T_>); // @count "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[*]" 2 // @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].name" \"\'a\" diff --git a/tests/rustdoc-json/primitives/primitive_overloading.rs b/tests/rustdoc-json/primitives/primitive_overloading.rs index 81e0acdc6..50e23fc06 100644 --- a/tests/rustdoc-json/primitives/primitive_overloading.rs +++ b/tests/rustdoc-json/primitives/primitive_overloading.rs @@ -3,14 +3,10 @@ // Regression test for <https://github.com/rust-lang/rust/issues/98006>. #![feature(rustc_attrs)] -#![feature(no_core)] - -#![no_core] // @has "$.index[*][?(@.name=='usize')]" // @has "$.index[*][?(@.name=='prim')]" #[rustc_doc_primitive = "usize"] /// This is the built-in type `usize`. -mod prim { -} +mod prim {} diff --git a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs index 37ca279b3..a8f5500d6 100644 --- a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs +++ b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs @@ -1,8 +1,5 @@ //! Regression test for <https://github.com/rust-lang/rust/issues/100531> -#![feature(no_core)] -#![no_core] - #![crate_name = "export_extern_crate_as_self"] // ignore-tidy-linelength diff --git a/tests/rustdoc-json/reexport/glob_collision.rs b/tests/rustdoc-json/reexport/glob_collision.rs index dee35ba78..9a75f4c0c 100644 --- a/tests/rustdoc-json/reexport/glob_collision.rs +++ b/tests/rustdoc-json/reexport/glob_collision.rs @@ -1,8 +1,5 @@ // Regression test for https://github.com/rust-lang/rust/issues/100973 -#![feature(no_core)] -#![no_core] - // @set m1 = "$.index[*][?(@.name == 'm1' && @.inner.module)].id" // @is "$.index[*][?(@.name == 'm1')].inner.module.items" [] // @is "$.index[*][?(@.name == 'm1')].inner.module.is_stripped" true diff --git a/tests/rustdoc-json/reexport/glob_extern.rs b/tests/rustdoc-json/reexport/glob_extern.rs index 78edfaf0a..ed0c4a420 100644 --- a/tests/rustdoc-json/reexport/glob_extern.rs +++ b/tests/rustdoc-json/reexport/glob_extern.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true" mod mod1 { extern "C" { diff --git a/tests/rustdoc-json/reexport/glob_private.rs b/tests/rustdoc-json/reexport/glob_private.rs index ae4e87d23..11ea5aa35 100644 --- a/tests/rustdoc-json/reexport/glob_private.rs +++ b/tests/rustdoc-json/reexport/glob_private.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true" mod mod1 { // @is "$.index[*][?(@.name=='mod2')].inner.module.is_stripped" "true" diff --git a/tests/rustdoc-json/reexport/in_root_and_mod.rs b/tests/rustdoc-json/reexport/in_root_and_mod.rs index f81445bd4..a4133e2f0 100644 --- a/tests/rustdoc-json/reexport/in_root_and_mod.rs +++ b/tests/rustdoc-json/reexport/in_root_and_mod.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - // @!has "$.index[*][?(@.name=='foo')]" mod foo { // @has "$.index[*][?(@.name=='Foo')]" diff --git a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs index c5c41b25f..37f7b26fc 100644 --- a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs +++ b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - pub mod foo { // @set bar_id = "$.index[*][?(@.name=='Bar')].id" // @ismany "$.index[*][?(@.name=='foo')].inner.module.items[*]" $bar_id diff --git a/tests/rustdoc-json/reexport/macro.rs b/tests/rustdoc-json/reexport/macro.rs index ac0632b98..be09cb476 100644 --- a/tests/rustdoc-json/reexport/macro.rs +++ b/tests/rustdoc-json/reexport/macro.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @set repro_id = "$.index[*][?(@.name=='repro')].id" #[macro_export] macro_rules! repro { diff --git a/tests/rustdoc-json/reexport/mod_not_included.rs b/tests/rustdoc-json/reexport/mod_not_included.rs index 1c49f213d..bc072be81 100644 --- a/tests/rustdoc-json/reexport/mod_not_included.rs +++ b/tests/rustdoc-json/reexport/mod_not_included.rs @@ -1,8 +1,5 @@ // Regression test for https://github.com/rust-lang/rust/issues/101103 -#![feature(no_core)] -#![no_core] - mod m1 { pub fn x() {} } diff --git a/tests/rustdoc-json/reexport/private_twice_one_inline.rs b/tests/rustdoc-json/reexport/private_twice_one_inline.rs index 8c8152bd1..d7b766235 100644 --- a/tests/rustdoc-json/reexport/private_twice_one_inline.rs +++ b/tests/rustdoc-json/reexport/private_twice_one_inline.rs @@ -4,12 +4,8 @@ // Test for the ICE in https://github.com/rust-lang/rust/issues/83057 // An external type re-exported with different attributes shouldn't cause an error -#![no_core] -#![feature(no_core)] - extern crate pub_struct as foo; #[doc(inline)] - // @set crate_use_id = "$.index[*][?(@.docs=='Hack A')].id" // @set foo_id = "$.index[*][?(@.docs=='Hack A')].inner.import.id" /// Hack A diff --git a/tests/rustdoc-json/reexport/private_two_names.rs b/tests/rustdoc-json/reexport/private_two_names.rs index cdcbf2a2b..e6f037eb4 100644 --- a/tests/rustdoc-json/reexport/private_two_names.rs +++ b/tests/rustdoc-json/reexport/private_two_names.rs @@ -3,9 +3,6 @@ // Test for the ICE in https://github.com/rust-lang/rust/issues/83720 // A pub-in-private type re-exported under two different names shouldn't cause an error -#![no_core] -#![feature(no_core)] - // @!has "$.index[*][?(@.name=='style')]" mod style { // @set color_struct_id = "$.index[*][?(@.inner.struct && @.name=='Color')].id" diff --git a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs index a2a25d084..15d194ef5 100644 --- a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs +++ b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs @@ -1,15 +1,13 @@ // Regression test for <https://github.com/rust-lang/rust/issues/106379> -#![feature(no_core)] -#![no_core] - mod repeat_n { #[doc(hidden)] + /// not here pub struct RepeatN {} } +/// not here pub use repeat_n::RepeatN; // @count "$.index[*][?(@.name=='pub_use_doc_hidden')].inner.items[*]" 0 -// @!has "$.index[*][?(@.kind=='struct')]" -// @!has "$.index[*][?(@.kind=='import')]" +// @!has "$.index[*][?(@.docs == 'not here')]" diff --git a/tests/rustdoc-json/reexport/reexport_of_hidden.rs b/tests/rustdoc-json/reexport/reexport_of_hidden.rs new file mode 100644 index 000000000..1b6ff5fad --- /dev/null +++ b/tests/rustdoc-json/reexport/reexport_of_hidden.rs @@ -0,0 +1,10 @@ +// compile-flags: --document-hidden-items + +// @has "$.index[*].inner[?(@.import.name=='UsedHidden')]" +// @has "$.index[*][?(@.name=='Hidden')]" +pub mod submodule { + #[doc(hidden)] + pub struct Hidden {} +} + +pub use submodule::Hidden as UsedHidden; diff --git a/tests/rustdoc-json/reexport/rename_private.rs b/tests/rustdoc-json/reexport/rename_private.rs index 911446023..3924282a4 100644 --- a/tests/rustdoc-json/reexport/rename_private.rs +++ b/tests/rustdoc-json/reexport/rename_private.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @!has "$.index[*][?(@.name=='inner')]" mod inner { // @has "$.index[*][?(@.name=='Public')]" diff --git a/tests/rustdoc-json/reexport/rename_public.rs b/tests/rustdoc-json/reexport/rename_public.rs index d0fd314bd..636937874 100644 --- a/tests/rustdoc-json/reexport/rename_public.rs +++ b/tests/rustdoc-json/reexport/rename_public.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @set inner_id = "$.index[*][?(@.name=='inner')].id" pub mod inner { // @set public_id = "$.index[*][?(@.name=='Public')].id" diff --git a/tests/rustdoc-json/reexport/same_name_different_types.rs b/tests/rustdoc-json/reexport/same_name_different_types.rs index 6a765b733..42ba6c400 100644 --- a/tests/rustdoc-json/reexport/same_name_different_types.rs +++ b/tests/rustdoc-json/reexport/same_name_different_types.rs @@ -1,8 +1,5 @@ // Regression test for <https://github.com/rust-lang/rust/issues/107677>. -#![feature(no_core)] -#![no_core] - pub mod nested { // @set foo_struct = "$.index[*][?(@.docs == 'Foo the struct')].id" diff --git a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs index a00547dc3..1e1710e1c 100644 --- a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs +++ b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs @@ -2,9 +2,7 @@ // Regression test for <https://github.com/rust-lang/rust/issues/97432>. -#![feature(no_core)] #![no_std] -#![no_core] mod inner { // @set trait_id = "$.index[*][?(@.name=='Trait')].id" diff --git a/tests/rustdoc-json/reexport/simple_private.rs b/tests/rustdoc-json/reexport/simple_private.rs index 462efee51..2ca8c7fa6 100644 --- a/tests/rustdoc-json/reexport/simple_private.rs +++ b/tests/rustdoc-json/reexport/simple_private.rs @@ -1,6 +1,4 @@ // edition:2018 -#![no_core] -#![feature(no_core)] // @!has "$.index[*][?(@.name=='inner')]" mod inner { diff --git a/tests/rustdoc-json/reexport/simple_public.rs b/tests/rustdoc-json/reexport/simple_public.rs index 1373f96f8..04611eeb9 100644 --- a/tests/rustdoc-json/reexport/simple_public.rs +++ b/tests/rustdoc-json/reexport/simple_public.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @set inner_id = "$.index[*][?(@.name=='inner')].id" pub mod inner { diff --git a/tests/rustdoc-json/return_private.rs b/tests/rustdoc-json/return_private.rs index 0ce81b5e5..a9301b3fe 100644 --- a/tests/rustdoc-json/return_private.rs +++ b/tests/rustdoc-json/return_private.rs @@ -1,9 +1,6 @@ // Regression test for <https://github.com/rust-lang/rust/issues/96161>. // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - mod secret { pub struct Secret; } diff --git a/tests/rustdoc-json/stripped_modules.rs b/tests/rustdoc-json/stripped_modules.rs index d2664b49e..d5ab1173d 100644 --- a/tests/rustdoc-json/stripped_modules.rs +++ b/tests/rustdoc-json/stripped_modules.rs @@ -1,6 +1,3 @@ -#![no_core] -#![feature(no_core)] - // @!has "$.index[*][?(@.name=='no_pub_inner')]" mod no_pub_inner { fn priv_inner() {} diff --git a/tests/rustdoc-json/traits/implementors.rs b/tests/rustdoc-json/traits/implementors.rs index 7d351ad61..c27553c75 100644 --- a/tests/rustdoc-json/traits/implementors.rs +++ b/tests/rustdoc-json/traits/implementors.rs @@ -1,19 +1,18 @@ -#![feature(no_core)] -#![no_core] - -// @set wham = "$.index[*][?(@.name=='Wham')].id" -// @count "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" 1 -// @set gmWham = "$.index[*][?(@.name=='Wham')].inner.trait.implementations[0]" pub trait Wham {} - -// @count "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" 1 -// @is "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[0]" $gmWham -// @set gm = "$.index[*][?(@.name=='Wham')].id" - -// jsonpath_lib isnt expressive enough (for now) to get the "impl" item, so we -// just check it isn't pointing to the type, but when you port to jsondocck-ng -// check what the impl item is -// @!is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[0]" $gm pub struct GeorgeMichael {} +/// Wham for George Michael impl Wham for GeorgeMichael {} + +// Find IDs. +// @set wham = "$.index[*][?(@.name=='Wham')].id" +// @set gmWham = "$.index[*][?(@.docs=='Wham for George Michael')].id" +// @set gm = "$.index[*][?(@.name=='GeorgeMichael')].id" + +// Both struct and trait point to impl. +// @has "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" $gmWham +// @is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" $gmWham + +// Impl points to both struct and trait. +// @is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.trait.id" $wham +// @is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.for.resolved_path.id" $gm diff --git a/tests/rustdoc-json/traits/private_supertrait.rs b/tests/rustdoc-json/traits/private_supertrait.rs index 49238e5e8..67b5a858a 100644 --- a/tests/rustdoc-json/traits/private_supertrait.rs +++ b/tests/rustdoc-json/traits/private_supertrait.rs @@ -1,9 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - - // @!has "$.index[*][?(@.name == 'sealed')]" mod sealed { // @set sealed_id = "$.index[*][?(@.name=='Sealed')].id" diff --git a/tests/rustdoc-json/traits/supertrait.rs b/tests/rustdoc-json/traits/supertrait.rs index 2123ac404..bbae3557c 100644 --- a/tests/rustdoc-json/traits/supertrait.rs +++ b/tests/rustdoc-json/traits/supertrait.rs @@ -1,9 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![feature(lang_items)] -#![no_core] - // @set loud_id = "$.index[*][?(@.name=='Loud')].id" pub trait Loud {} diff --git a/tests/rustdoc-json/type/inherent_associated_type.rs b/tests/rustdoc-json/type/inherent_associated_type.rs index 64c6c53ce..f86031479 100644 --- a/tests/rustdoc-json/type/inherent_associated_type.rs +++ b/tests/rustdoc-json/type/inherent_associated_type.rs @@ -1,8 +1,6 @@ // ignore-tidy-linelength #![feature(inherent_associated_types)] -#![feature(no_core)] #![allow(incomplete_features)] -#![no_core] // @set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id' pub struct OwnerMetadata; diff --git a/tests/rustdoc-json/type/inherent_associated_type_bound.rs b/tests/rustdoc-json/type/inherent_associated_type_bound.rs index 8e39f4718..6da23c8fb 100644 --- a/tests/rustdoc-json/type/inherent_associated_type_bound.rs +++ b/tests/rustdoc-json/type/inherent_associated_type_bound.rs @@ -16,5 +16,5 @@ pub struct Carrier<'a>(&'a ()); pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {} impl<'a> Carrier<'a> { - pub type Focus<T> = &'a mut T; + pub type Focus<T> = &'a mut T where T: 'a; } diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs index 5c500ce6c..806b6d125 100644 --- a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs +++ b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs @@ -1,2 +1,2 @@ // check-fail -// compile-flags: --check-cfg=names() +// compile-flags: --check-cfg=cfg() diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.rs b/tests/rustdoc-ui/check-cfg/check-cfg.rs index fa8789ad3..96fa9e08d 100644 --- a/tests/rustdoc-ui/check-cfg/check-cfg.rs +++ b/tests/rustdoc-ui/check-cfg/check-cfg.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: --check-cfg=names() -Z unstable-options +// compile-flags: --check-cfg=cfg() -Z unstable-options /// uniz is nor a builtin nor pass as arguments so is unexpected #[cfg(uniz)] diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.stderr b/tests/rustdoc-ui/check-cfg/check-cfg.stderr index 03fb6f96f..d010c1f7e 100644 --- a/tests/rustdoc-ui/check-cfg/check-cfg.stderr +++ b/tests/rustdoc-ui/check-cfg/check-cfg.stderr @@ -1,4 +1,4 @@ -warning: unexpected `cfg` condition name +warning: unexpected `cfg` condition name: `uniz` --> $DIR/check-cfg.rs:5:7 | LL | #[cfg(uniz)] diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr index 4f2ded78c..ad0498042 100644 --- a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr +++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr @@ -28,6 +28,8 @@ LL | | LL | | /// main; LL | | /// ``` | |_______^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.rs b/tests/rustdoc-ui/doctest/check-cfg-test.rs index 49a801c3f..38cd59aa7 100644 --- a/tests/rustdoc-ui/doctest/check-cfg-test.rs +++ b/tests/rustdoc-ui/doctest/check-cfg-test.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: --test --nocapture --check-cfg=values(feature,"test") -Z unstable-options +// compile-flags: --test --nocapture --check-cfg=cfg(feature,values("test")) -Z unstable-options // normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.stderr b/tests/rustdoc-ui/doctest/check-cfg-test.stderr index f84543c20..0bfd569e3 100644 --- a/tests/rustdoc-ui/doctest/check-cfg-test.stderr +++ b/tests/rustdoc-ui/doctest/check-cfg-test.stderr @@ -1,4 +1,4 @@ -warning: unexpected `cfg` condition value +warning: unexpected `cfg` condition value: `invalid` --> $DIR/check-cfg-test.rs:9:7 | LL | #[cfg(feature = "invalid")] diff --git a/tests/rustdoc-ui/error-in-impl-trait/closure.rs b/tests/rustdoc-ui/error-in-impl-trait/closure.rs index f1fd85bb2..628c61a6a 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/closure.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/closure.rs @@ -1,5 +1,5 @@ // check-pass -// manually desugared version of an `async fn` (but with a closure instead of a generator) +// manually desugared version of an `async fn` (but with a closure instead of a coroutine) pub fn a() -> impl Fn() -> u32 { || content::doesnt::matter() } diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs index e49fe0798..7151ebd59 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs @@ -1,7 +1,6 @@ -// check-pass - pub fn f() -> impl Sized { pub enum E { + //~^ ERROR: recursive type V(E), } diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.stderr b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.stderr new file mode 100644 index 000000000..edb5dfd4d --- /dev/null +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.stderr @@ -0,0 +1,17 @@ +error[E0072]: recursive type `f::E` has infinite size + --> $DIR/infinite-recursive-type-2.rs:2:5 + | +LL | pub enum E { + | ^^^^^^^^^^ +LL | +LL | V(E), + | - recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | V(Box<E>), + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs index 096130d77..1f8550517 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs @@ -1,7 +1,6 @@ -// check-pass - fn f() -> impl Sized { enum E { + //~^ ERROR: recursive type V(E), } diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.stderr b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.stderr new file mode 100644 index 000000000..349a56941 --- /dev/null +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.stderr @@ -0,0 +1,17 @@ +error[E0072]: recursive type `f::E` has infinite size + --> $DIR/infinite-recursive-type.rs:2:5 + | +LL | enum E { + | ^^^^^^ +LL | +LL | V(E), + | - recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | V(Box<E>), + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs b/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs new file mode 100644 index 000000000..6e4709403 --- /dev/null +++ b/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs @@ -0,0 +1,16 @@ +// check-pass + +// Test that associated item impls on primitive types don't crash rustdoc + +// https://github.com/rust-lang/rust/issues/31808 +#![crate_name="issue_31808"] + +pub trait Foo { + const BAR: usize; + type BAZ; +} + +impl Foo for () { + const BAR: usize = 0; + type BAZ = usize; +} diff --git a/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr b/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr index 83e0d3962..b25849f25 100644 --- a/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr +++ b/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr @@ -22,6 +22,7 @@ LL | /// [1] | ^ no item named `1` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` warning: 3 warnings emitted diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs b/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs index c3f4fd63b..07fc239a8 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs @@ -4,3 +4,8 @@ trait X { fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments //~| ERROR associated type takes 0 generic arguments but 1 generic argument +//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments +//~| ERROR associated type takes 0 generic arguments but 1 generic argument +//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments +//~| ERROR associated type takes 0 generic arguments but 1 generic argument +//~| ERROR trait `X` cannot be made into an object diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr index 527729a82..50d552847 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -28,6 +28,86 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ -error: aborting due to 2 previous errors +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/invalid_const_in_lifetime_position.rs:4:26 + | +LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} + | ^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/invalid_const_in_lifetime_position.rs:2:10 + | +LL | type Y<'a>; + | ^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {} + | +++ + +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/invalid_const_in_lifetime_position.rs:4:26 + | +LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} + | ^--- help: remove these generics + | | + | expected 0 generic arguments + | +note: associated type defined here, with 0 generic parameters + --> $DIR/invalid_const_in_lifetime_position.rs:2:10 + | +LL | type Y<'a>; + | ^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/invalid_const_in_lifetime_position.rs:4:26 + | +LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} + | ^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/invalid_const_in_lifetime_position.rs:2:10 + | +LL | type Y<'a>; + | ^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {} + | +++ + +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/invalid_const_in_lifetime_position.rs:4:26 + | +LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} + | ^--- help: remove these generics + | | + | expected 0 generic arguments + | +note: associated type defined here, with 0 generic parameters + --> $DIR/invalid_const_in_lifetime_position.rs:2:10 + | +LL | type Y<'a>; + | ^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0038]: the trait `X` cannot be made into an object + --> $DIR/invalid_const_in_lifetime_position.rs:4:20 + | +LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} + | ^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/invalid_const_in_lifetime_position.rs:2:10 + | +LL | trait X { + | - this trait cannot be made into an object... +LL | type Y<'a>; + | ^ ...because it contains the generic associated type `Y` + = help: consider moving `Y` to another trait + +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0038, E0107. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/rustdoc-ui/issues/issue-105742.rs b/tests/rustdoc-ui/issues/issue-105742.rs index 1fbb70c78..5e493515c 100644 --- a/tests/rustdoc-ui/issues/issue-105742.rs +++ b/tests/rustdoc-ui/issues/issue-105742.rs @@ -21,6 +21,8 @@ pub trait SVec: Index< //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` Output = <Index<<Self as SVec>::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument @@ -30,6 +32,8 @@ pub trait SVec: Index< //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` Output = <Self as SVec>::Item> as SVec>::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument @@ -47,6 +51,10 @@ pub trait SVec: Index< //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` > { type Item<'a, T>; diff --git a/tests/rustdoc-ui/issues/issue-105742.stderr b/tests/rustdoc-ui/issues/issue-105742.stderr index b63176c91..ad1020a1f 100644 --- a/tests/rustdoc-ui/issues/issue-105742.stderr +++ b/tests/rustdoc-ui/issues/issue-105742.stderr @@ -5,7 +5,7 @@ LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -21,7 +21,7 @@ LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - @@ -31,13 +31,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:24:37 + --> $DIR/issue-105742.rs:26:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -47,13 +47,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:24:37 + --> $DIR/issue-105742.rs:26:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - @@ -63,13 +63,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:30 + --> $DIR/issue-105742.rs:37:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -79,13 +79,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:30 + --> $DIR/issue-105742.rs:37:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - @@ -95,13 +95,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:46 + --> $DIR/issue-105742.rs:37:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -111,13 +111,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:46 + --> $DIR/issue-105742.rs:37:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - @@ -133,7 +133,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -149,7 +149,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - @@ -165,10 +165,11 @@ LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | <Self as SVec>::Item<'a>, @@ -181,106 +182,113 @@ LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing generic argument | LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:24:37 + --> $DIR/issue-105742.rs:26:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:24:37 + --> $DIR/issue-105742.rs:26:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing generic argument | LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:30 + --> $DIR/issue-105742.rs:37:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:30 + --> $DIR/issue-105742.rs:37:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing generic argument | LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:46 + --> $DIR/issue-105742.rs:37:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:46 + --> $DIR/issue-105742.rs:37:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing generic argument | LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, @@ -323,10 +331,11 @@ LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | <Self as SVec>::Item<'a>, @@ -339,119 +348,126 @@ LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing generic argument | LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:24:37 + --> $DIR/issue-105742.rs:26:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:24:37 + --> $DIR/issue-105742.rs:26:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing generic argument | LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:30 + --> $DIR/issue-105742.rs:37:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:30 + --> $DIR/issue-105742.rs:37:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing generic argument | LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:46 + --> $DIR/issue-105742.rs:37:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:33:46 + --> $DIR/issue-105742.rs:37:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing generic argument | LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:53:38 + --> $DIR/issue-105742.rs:61:38 | LL | fn len(&self) -> <Self as SVec>::Item; | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -461,13 +477,13 @@ LL | fn len(&self) -> <Self as SVec>::Item<'_>; | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:53:38 + --> $DIR/issue-105742.rs:61:38 | LL | fn len(&self) -> <Self as SVec>::Item; | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:51:10 + --> $DIR/issue-105742.rs:59:10 | LL | type Item<'a, T>; | ^^^^ - @@ -476,7 +492,143 @@ help: add missing generic argument LL | fn len(&self) -> <Self as SVec>::Item<T>; | +++ -error: aborting due to 29 previous errors +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:15:21 + | +LL | <Self as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:59:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | <Self as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:15:21 + | +LL | <Self as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:59:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | <Self as SVec>::Item<T>, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:26:37 + | +LL | Output = <Index<<Self as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:59:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = <Index<<Self as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:26:37 + | +LL | Output = <Index<<Self as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:59:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = <Index<<Self as SVec>::Item<T>, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:37:30 + | +LL | Output = <Self as SVec>::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:59:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:37:30 + | +LL | Output = <Self as SVec>::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:59:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:37:46 + | +LL | Output = <Self as SVec>::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:59:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:37:46 + | +LL | Output = <Self as SVec>::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:59:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, + | +++ + +error: aborting due to 37 previous errors Some errors have detailed explanations: E0038, E0107. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/rustdoc-ui/issues/issue-107918.rs b/tests/rustdoc-ui/issues/issue-107918.rs index 13788df0f..0ddb3dc92 100644 --- a/tests/rustdoc-ui/issues/issue-107918.rs +++ b/tests/rustdoc-ui/issues/issue-107918.rs @@ -1,7 +1,7 @@ // aux-build:panic-handler.rs // compile-flags: --document-private-items // build-pass -// ignore-windows +// only-linux #![no_std] #![no_main] diff --git a/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout b/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout index bbf66a315..6021bce69 100644 --- a/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout +++ b/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout @@ -14,11 +14,11 @@ Lint groups provided by rustc: $NAMES $SUB_LINTS -Lint checks provided by plugins loaded by this crate: +Lint checks loaded by this crate: $NAMES $LEVELS $MEANINGS -Lint groups provided by plugins loaded by this crate: +Lint groups loaded by this crate: $NAMES $SUB_LINTS diff --git a/tests/rustdoc-ui/issues/issue-96287.stderr b/tests/rustdoc-ui/issues/issue-96287.stderr index 7722eb960..c4809a311 100644 --- a/tests/rustdoc-ui/issues/issue-96287.stderr +++ b/tests/rustdoc-ui/issues/issue-96287.stderr @@ -2,7 +2,12 @@ error[E0220]: associated type `Assoc` not found for `V` --> $DIR/issue-96287.rs:7:33 | LL | pub type Foo<V> = impl Trait<V::Assoc>; - | ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc` + | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` + | +help: consider restricting type parameter `V` + | +LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>; + | ++++++++++++++++ error: aborting due to previous error diff --git a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs index c34ea0567..ce94a06c3 100644 --- a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs +++ b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs @@ -1,12 +1,7 @@ +// compile-flags: -Zdeduplicate-diagnostics=yes #![deny(unknown_lints)] //~^ NOTE defined here #![allow(rustdoc::missing_doc_code_examples)] //~^ ERROR unknown lint -//~| ERROR unknown lint -//~| ERROR unknown lint //~| NOTE lint is unstable -//~| NOTE lint is unstable -//~| NOTE lint is unstable -//~| NOTE see issue -//~| NOTE see issue //~| NOTE see issue diff --git a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr index 326dcfe3b..b8a08e943 100644 --- a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr +++ b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr @@ -1,5 +1,5 @@ error: unknown lint: `rustdoc::missing_doc_code_examples` - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1 + --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:4:1 | LL | #![allow(rustdoc::missing_doc_code_examples)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,30 +8,10 @@ LL | #![allow(rustdoc::missing_doc_code_examples)] = note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information = help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable note: the lint level is defined here - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:1:9 + --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:2:9 | LL | #![deny(unknown_lints)] | ^^^^^^^^^^^^^ -error: unknown lint: `rustdoc::missing_doc_code_examples` - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1 - | -LL | #![allow(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: the `rustdoc::missing_doc_code_examples` lint is unstable - = note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information - = help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable - -error: unknown lint: `rustdoc::missing_doc_code_examples` - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1 - | -LL | #![allow(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: the `rustdoc::missing_doc_code_examples` lint is unstable - = note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information - = help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/rustdoc/not-wf-ambiguous-normalization.rs b/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs index 1e9f925f8..3e4825d83 100644 --- a/tests/rustdoc/not-wf-ambiguous-normalization.rs +++ b/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs @@ -12,6 +12,7 @@ struct DefaultAllocator; // `<DefaultAllocator as Allocator>::Buffer` to be ambiguous, // which caused an ICE with `-Znormalize-docs`. impl<T> Allocator for DefaultAllocator { + //~^ ERROR: type annotations needed type Buffer = (); } diff --git a/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr b/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr new file mode 100644 index 000000000..34b20a0b3 --- /dev/null +++ b/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/not-wf-ambiguous-normalization.rs:14:23 + | +LL | impl<T> Allocator for DefaultAllocator { + | ^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/rustdoc-ui/recursive-deref-ice.rs b/tests/rustdoc-ui/recursive-deref-ice.rs index c44fd27f4..9e62841f9 100644 --- a/tests/rustdoc-ui/recursive-deref-ice.rs +++ b/tests/rustdoc-ui/recursive-deref-ice.rs @@ -4,7 +4,10 @@ pub struct Attribute; -pub struct Map<'hir> {} +pub struct Map<'hir> { + lt: &'hir (), +} + impl<'hir> Map<'hir> { pub fn attrs(&self) -> &'hir [Attribute] { &[] } } diff --git a/tests/rustdoc-ui/unable-fulfill-trait.rs b/tests/rustdoc-ui/unable-fulfill-trait.rs index 703570822..10887ab19 100644 --- a/tests/rustdoc-ui/unable-fulfill-trait.rs +++ b/tests/rustdoc-ui/unable-fulfill-trait.rs @@ -3,7 +3,8 @@ pub struct Foo<'a, 'b, T> { field1: dyn Bar<'a, 'b,>, //~^ ERROR - //~^^ ERROR + //~| ERROR + //~| ERROR } pub trait Bar<'x, 's, U> diff --git a/tests/rustdoc-ui/unable-fulfill-trait.stderr b/tests/rustdoc-ui/unable-fulfill-trait.stderr index 72f35cb92..d7735a4fd 100644 --- a/tests/rustdoc-ui/unable-fulfill-trait.stderr +++ b/tests/rustdoc-ui/unable-fulfill-trait.stderr @@ -5,7 +5,7 @@ LL | field1: dyn Bar<'a, 'b,>, | ^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `U` - --> $DIR/unable-fulfill-trait.rs:9:11 + --> $DIR/unable-fulfill-trait.rs:10:11 | LL | pub trait Bar<'x, 's, U> | ^^^ - @@ -20,7 +20,24 @@ error[E0227]: ambiguous lifetime bound, explicit lifetime bound required LL | field1: dyn Bar<'a, 'b,>, | ^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0478]: lifetime bound not satisfied + --> $DIR/unable-fulfill-trait.rs:4:13 + | +LL | field1: dyn Bar<'a, 'b,>, + | ^^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'b` as defined here + --> $DIR/unable-fulfill-trait.rs:3:20 + | +LL | pub struct Foo<'a, 'b, T> { + | ^^ +note: but lifetime parameter must outlive the lifetime `'a` as defined here + --> $DIR/unable-fulfill-trait.rs:3:16 + | +LL | pub struct Foo<'a, 'b, T> { + | ^^ + +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0107, E0227. +Some errors have detailed explanations: E0107, E0227, E0478. For more information about an error, try `rustc --explain E0107`. diff --git a/tests/rustdoc-ui/unescaped_backticks.stderr b/tests/rustdoc-ui/unescaped_backticks.stderr index 83822f778..2b4e491b1 100644 --- a/tests/rustdoc-ui/unescaped_backticks.stderr +++ b/tests/rustdoc-ui/unescaped_backticks.stderr @@ -302,6 +302,7 @@ LL | | /// level changes. = help: if you meant to use a literal backtick, escape it change: or `None` if it isn't. to this: or `None\` if it isn't. + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: unescaped backtick --> $DIR/unescaped_backticks.rs:323:5 @@ -321,6 +322,7 @@ LL | | /// level changes. = help: if you meant to use a literal backtick, escape it change: `on_event` should be called. to this: `on_event\` should be called. + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: unescaped backtick --> $DIR/unescaped_backticks.rs:323:5 @@ -340,6 +342,7 @@ LL | | /// level changes. = help: if you meant to use a literal backtick, escape it change: [`rebuild_interest_cache`][rebuild] is called after the value of the max to this: [`rebuild_interest_cache\`][rebuild] is called after the value of the max + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: unescaped backtick --> $DIR/unescaped_backticks.rs:349:56 diff --git a/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs b/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs new file mode 100644 index 000000000..ffb0765d3 --- /dev/null +++ b/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs @@ -0,0 +1,46 @@ +// https://github.com/rust-lang/rust/issues/25001 +#![crate_name="issue_25001"] + +// @has issue_25001/struct.Foo.html +pub struct Foo<T>(T); + +pub trait Bar { + type Item; + + fn quux(self); +} + +impl Foo<u8> { + // @has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()' + pub fn pass() {} +} +impl Foo<u16> { + // @has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize' + pub fn pass() -> usize { 42 } +} +impl Foo<u32> { + // @has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize' + pub fn pass() -> isize { 42 } +} + +impl<T> Bar for Foo<T> { + // @has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' 'type Item = T' + type Item=T; + + // @has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)' + fn quux(self) {} +} +impl<'a, T> Bar for &'a Foo<T> { + // @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item = &'a T" + type Item=&'a T; + + // @has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)' + fn quux(self) {} +} +impl<'a, T> Bar for &'a mut Foo<T> { + // @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T" + type Item=&'a mut T; + + // @has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)' + fn quux(self) {} +} diff --git a/tests/rustdoc/anchor-id-trait-tymethod-28478.rs b/tests/rustdoc/anchor-id-trait-tymethod-28478.rs new file mode 100644 index 000000000..5685040dc --- /dev/null +++ b/tests/rustdoc/anchor-id-trait-tymethod-28478.rs @@ -0,0 +1,34 @@ +// https://github.com/rust-lang/rust/issues/28478 +#![crate_name="issue_28478"] + +#![feature(associated_type_defaults)] + +// @has issue_28478/trait.Bar.html +pub trait Bar { + // @has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()' + // @has - '//*[@href="#associatedtype.Bar"]' 'Bar' + type Bar = (); + // @has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize' + // @has - '//*[@href="#associatedconstant.Baz"]' 'Baz' + const Baz: usize = 7; + // @has - '//*[@id="tymethod.bar"]' 'fn bar' + fn bar(); + // @has - '//*[@id="method.baz"]' 'fn baz' + fn baz() { } +} + +// @has issue_28478/struct.Foo.html +pub struct Foo; + +impl Foo { + // @has - '//*[@href="#method.foo"]' 'foo' + pub fn foo() {} +} + +impl Bar for Foo { + // @has - '//*[@href="trait.Bar.html#associatedtype.Bar"]' 'Bar' + // @has - '//*[@href="trait.Bar.html#associatedconstant.Baz"]' 'Baz' + // @has - '//*[@href="trait.Bar.html#tymethod.bar"]' 'bar' + fn bar() {} + // @has - '//*[@href="trait.Bar.html#method.baz"]' 'baz' +} diff --git a/tests/rustdoc/async-trait-sig.rs b/tests/rustdoc/async-trait-sig.rs index 2578bc8f7..db1848f71 100644 --- a/tests/rustdoc/async-trait-sig.rs +++ b/tests/rustdoc/async-trait-sig.rs @@ -1,6 +1,5 @@ // edition:2021 -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] pub trait Foo { diff --git a/tests/rustdoc/async-trait.rs b/tests/rustdoc/async-trait.rs index a473e4674..8de95aac2 100644 --- a/tests/rustdoc/async-trait.rs +++ b/tests/rustdoc/async-trait.rs @@ -1,7 +1,6 @@ // aux-build:async-trait-dep.rs // edition:2021 -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] extern crate async_trait_dep; diff --git a/tests/rustdoc/auxiliary/async-trait-dep.rs b/tests/rustdoc/auxiliary/async-trait-dep.rs index 10a55dd02..d455ee99e 100644 --- a/tests/rustdoc/auxiliary/async-trait-dep.rs +++ b/tests/rustdoc/auxiliary/async-trait-dep.rs @@ -1,6 +1,5 @@ // edition:2021 -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] pub trait Meow { diff --git a/tests/rustdoc/auxiliary/enum-variant.rs b/tests/rustdoc/auxiliary/enum-variant.rs new file mode 100644 index 000000000..a0a7fd894 --- /dev/null +++ b/tests/rustdoc/auxiliary/enum-variant.rs @@ -0,0 +1,48 @@ +#![crate_name = "bar"] + +pub enum E { + A = 12, + B, + C = 1245, +} + +pub enum F { + A, + B, +} + +#[repr(u32)] +pub enum G { + A = 12, + B, + C(u32), +} + +pub enum H { + A, + C(u32), +} + +#[repr(C)] +pub enum N { + A, + B, +} + +#[repr(C)] +pub enum O { + A(u32), + B, +} + +#[repr(u32)] +pub enum P { + A, + B, +} + +#[repr(u32)] +pub enum Q { + A(u32), + B, +} diff --git a/tests/rustdoc/blanket-impl-29503.rs b/tests/rustdoc/blanket-impl-29503.rs new file mode 100644 index 000000000..d6a132e1c --- /dev/null +++ b/tests/rustdoc/blanket-impl-29503.rs @@ -0,0 +1,21 @@ +// https://github.com/rust-lang/rust/issues/29503 +#![crate_name="issue_29503"] + +use std::fmt; + +// @has issue_29503/trait.MyTrait.html +pub trait MyTrait { + fn my_string(&self) -> String; +} + +// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header']" "impl<T> MyTrait for Twhere T: Debug" +impl<T> MyTrait for T +where + T: fmt::Debug, +{ + fn my_string(&self) -> String { + format!("{:?}", self) + } +} + +pub fn main() {} diff --git a/tests/rustdoc/blanket-reexport-item.rs b/tests/rustdoc/blanket-reexport-item.rs index 437f0001f..315a38c30 100644 --- a/tests/rustdoc/blanket-reexport-item.rs +++ b/tests/rustdoc/blanket-reexport-item.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-S"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T' +// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-T"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T' pub struct S2 {} mod m { pub struct S {} diff --git a/tests/rustdoc/const-effect-param.rs b/tests/rustdoc/const-effect-param.rs index f50a9b96d..b6379c05a 100644 --- a/tests/rustdoc/const-effect-param.rs +++ b/tests/rustdoc/const-effect-param.rs @@ -1,3 +1,5 @@ +// Check that we don't render host effect parameters & arguments. + #![crate_name = "foo"] #![feature(effects, const_trait_impl)] diff --git a/tests/rustdoc/const-generics/add-impl.rs b/tests/rustdoc/const-generics/add-impl.rs index 195e47bc8..df490d2c6 100644 --- a/tests/rustdoc/const-generics/add-impl.rs +++ b/tests/rustdoc/const-generics/add-impl.rs @@ -7,7 +7,7 @@ pub struct Simd<T, const WIDTH: usize> { inner: T, } -// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add<Simd<u8, 16>> for Simd<u8, 16>' +// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add for Simd<u8, 16>' impl Add for Simd<u8, 16> { type Output = Self; diff --git a/tests/rustdoc/const-generics/const-impl.rs b/tests/rustdoc/const-generics/const-impl.rs index 152b643bf..f4eefcc1c 100644 --- a/tests/rustdoc/const-generics/const-impl.rs +++ b/tests/rustdoc/const-generics/const-impl.rs @@ -2,7 +2,9 @@ #![feature(adt_const_params)] #![crate_name = "foo"] -#[derive(PartialEq, Eq)] +use std::marker::ConstParamTy; + +#[derive(PartialEq, Eq, ConstParamTy)] pub enum Order { Sorted, Unsorted, @@ -31,7 +33,7 @@ impl<T> VSet<T, { Order::Unsorted }> { pub struct Escape<const S: &'static str>; -// @has foo/struct.Escape.html '//*[@id="impl-Escape%3Cr%23%22%3Cscript%3Ealert(%22Escape%22);%3C/script%3E%22%23%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>' +// @has foo/struct.Escape.html '//*[@id="impl-Escape%3C%22%3Cscript%3Ealert(%5C%22Escape%5C%22);%3C/script%3E%22%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>' impl Escape<r#"<script>alert("Escape");</script>"#> { pub fn f() {} } diff --git a/tests/rustdoc/const-rendering-macros-33302.rs b/tests/rustdoc/const-rendering-macros-33302.rs new file mode 100644 index 000000000..0f5cb9214 --- /dev/null +++ b/tests/rustdoc/const-rendering-macros-33302.rs @@ -0,0 +1,54 @@ +// https://github.com/rust-lang/rust/issues/33302 +#![crate_name="issue_33302"] + +// Ensure constant and array length values are not taken from source +// code, which wreaks havoc with macros. + +macro_rules! make { + ($n:expr) => { + pub struct S; + + // @has issue_33302/constant.CST.html \ + // '//pre[@class="rust item-decl"]' 'pub const CST: i32' + pub const CST: i32 = ($n * $n); + // @has issue_33302/static.ST.html \ + // '//pre[@class="rust item-decl"]' 'pub static ST: i32' + pub static ST: i32 = ($n * $n); + + pub trait T<X> { + fn ignore(_: &X) {} + const C: X; + // @has issue_33302/trait.T.html \ + // '//pre[@class="rust item-decl"]' 'const D: i32' + // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' + const D: i32 = ($n * $n); + } + + // @has issue_33302/struct.S.html \ + // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' + // @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]' + // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' + impl T<[i32; ($n * $n)]> for S { + const C: [i32; ($n * $n)] = [0; ($n * $n)]; + } + + // @has issue_33302/struct.S.html \ + // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' + // @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)' + // @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32' + impl T<(i32,)> for S { + const C: (i32,) = ($n,); + } + + // @has issue_33302/struct.S.html \ + // '//*[@class="impl"]' 'impl T<(i32, i32)> for S' + // @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)' + // @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32' + impl T<(i32, i32)> for S { + const C: (i32, i32) = ($n, $n); + const D: i32 = ($n / $n); + } + }; +} + +make!(4); diff --git a/tests/rustdoc/crate-version-escape.rs b/tests/rustdoc/crate-version-escape.rs index 8413709f1..f134d9baa 100644 --- a/tests/rustdoc/crate-version-escape.rs +++ b/tests/rustdoc/crate-version-escape.rs @@ -2,4 +2,4 @@ #![crate_name = "foo"] -// @has 'foo/index.html' '//li[@class="version"]' 'Version <script>alert("hi")</script>' +// @has 'foo/index.html' '//*[@class="version"]' '<script>alert("hi")</script>' diff --git a/tests/rustdoc/crate-version-extra.rs b/tests/rustdoc/crate-version-extra.rs new file mode 100644 index 000000000..72a2c4ba5 --- /dev/null +++ b/tests/rustdoc/crate-version-extra.rs @@ -0,0 +1,7 @@ +// compile-flags: '--crate-version=1.3.37-nightly (203c57dbe 2023-09-17)' + +#![crate_name="foo"] + +// main version next to logo, extra version data below it +// @has 'foo/index.html' '//h2/span[@class="version"]' '1.3.37-nightly' +// @has 'foo/index.html' '//nav[@class="sidebar"]/div[@class="version"]' '(203c57dbe 2023-09-17)' diff --git a/tests/rustdoc/crate-version.rs b/tests/rustdoc/crate-version.rs index 2592c9853..d4be845b7 100644 --- a/tests/rustdoc/crate-version.rs +++ b/tests/rustdoc/crate-version.rs @@ -1,3 +1,3 @@ // compile-flags: --crate-version=1.3.37 -// @has 'crate_version/index.html' '//*[@class="version"]' 'Version 1.3.37' +// @has 'crate_version/index.html' '//*[@class="version"]' '1.3.37' diff --git a/tests/rustdoc/decl-trailing-whitespace.declaration.html b/tests/rustdoc/decl-trailing-whitespace.declaration.html index d73393633..59c318c16 100644 --- a/tests/rustdoc/decl-trailing-whitespace.declaration.html +++ b/tests/rustdoc/decl-trailing-whitespace.declaration.html @@ -1,22 +1,16 @@ <code>pub trait Write { // Required methods fn <a href="#tymethod.poll_write" class="fn">poll_write</a>( - self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + self, cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, buf: &mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>] ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; -<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>( - self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, - cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> - ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; -<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>( - self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, - cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> - ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; +<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>(self, cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; +<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>(self, cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; // Provided method fn <a href="#method.poll_write_vectored" class="fn">poll_write_vectored</a>( - self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + self, cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, bufs: &[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>] ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>> { ... } diff --git a/tests/rustdoc/decl-trailing-whitespace.rs b/tests/rustdoc/decl-trailing-whitespace.rs index d2a12435d..667837743 100644 --- a/tests/rustdoc/decl-trailing-whitespace.rs +++ b/tests/rustdoc/decl-trailing-whitespace.rs @@ -9,21 +9,21 @@ pub struct Error; pub trait Write { // @snapshot 'declaration' - '//*[@class="rust item-decl"]//code' fn poll_write( - self: Option<String>, + self, cx: &mut Option<String>, buf: &mut [usize] ) -> Option<Result<usize, Error>>; fn poll_flush( - self: Option<String>, + self, cx: &mut Option<String> ) -> Option<Result<(), Error>>; fn poll_close( - self: Option<String>, + self, cx: &mut Option<String>, ) -> Option<Result<(), Error>>; fn poll_write_vectored( - self: Option<String>, + self, cx: &mut Option<String>, bufs: &[usize] ) -> Option<Result<usize, Error>> {} diff --git a/tests/rustdoc/deduplicate-glob-import-impl-21474.rs b/tests/rustdoc/deduplicate-glob-import-impl-21474.rs new file mode 100644 index 000000000..2a675b4b6 --- /dev/null +++ b/tests/rustdoc/deduplicate-glob-import-impl-21474.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/21474 +#![crate_name="issue_21474"] + +pub use inner::*; + +mod inner { + impl super::Blah for super::What { } +} + +pub trait Blah { } + +// @count issue_21474/struct.What.html \ +// '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 +pub struct What; diff --git a/tests/rustdoc/deduplicate-trait-impl-22025.rs b/tests/rustdoc/deduplicate-trait-impl-22025.rs new file mode 100644 index 000000000..65a556e3a --- /dev/null +++ b/tests/rustdoc/deduplicate-trait-impl-22025.rs @@ -0,0 +1,9 @@ +// aux-build:issue-22025.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/22025 +#![crate_name="issue_22025"] + +extern crate issue_22025; + +pub use issue_22025::foo::{Foo, Bar}; diff --git a/tests/rustdoc/deprecated-future-staged-api.rs b/tests/rustdoc/deprecated-future-staged-api.rs index 2670e7f5d..09120b8d4 100644 --- a/tests/rustdoc/deprecated-future-staged-api.rs +++ b/tests/rustdoc/deprecated-future-staged-api.rs @@ -1,12 +1,12 @@ #![feature(staged_api)] -#![stable(feature = "deprecated-future-staged-api", since = "1.0.0")] +#![stable(feature = "deprecated_future_staged_api", since = "1.0.0")] // @has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \ // 'Deprecation planned' // @has deprecated_future_staged_api/struct.S1.html '//*[@class="stab deprecated"]' \ // 'Deprecating in 99.99.99: effectively never' #[deprecated(since = "99.99.99", note = "effectively never")] -#[stable(feature = "deprecated-future-staged-api", since = "1.0.0")] +#[stable(feature = "deprecated_future_staged_api", since = "1.0.0")] pub struct S1; // @has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \ @@ -14,5 +14,5 @@ pub struct S1; // @has deprecated_future_staged_api/struct.S2.html '//*[@class="stab deprecated"]' \ // 'Deprecating in a future Rust version: literally never' #[deprecated(since = "TBD", note = "literally never")] -#[stable(feature = "deprecated-future-staged-api", since = "1.0.0")] +#[stable(feature = "deprecated_future_staged_api", since = "1.0.0")] pub struct S2; diff --git a/tests/rustdoc/deref/deref-mut-methods.rs b/tests/rustdoc/deref/deref-mut-methods.rs index fdf843422..65681f812 100644 --- a/tests/rustdoc/deref/deref-mut-methods.rs +++ b/tests/rustdoc/deref/deref-mut-methods.rs @@ -9,7 +9,7 @@ impl Foo { } // @has foo/struct.Bar.html -// @has - '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.foo"]' 'foo' +// @has - '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.foo"]' 'foo' pub struct Bar { foo: Foo, } diff --git a/tests/rustdoc/deref/deref-recursive-pathbuf.rs b/tests/rustdoc/deref/deref-recursive-pathbuf.rs index be2b42b5a..7aee3147b 100644 --- a/tests/rustdoc/deref/deref-recursive-pathbuf.rs +++ b/tests/rustdoc/deref/deref-recursive-pathbuf.rs @@ -8,9 +8,9 @@ // @has '-' '//*[@id="deref-methods-Path"]' 'Methods from Deref<Target = Path>' // @has '-' '//*[@class="impl-items"]//*[@id="method.exists"]' 'pub fn exists(&self)' // @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-PathBuf"]' 'Methods from Deref<Target=PathBuf>' -// @has '-' '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.as_path"]' 'as_path' +// @has '-' '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.as_path"]' 'as_path' // @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-Path"]' 'Methods from Deref<Target=Path>' -// @has '-' '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.exists"]' 'exists' +// @has '-' '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.exists"]' 'exists' #![crate_name = "foo"] diff --git a/tests/rustdoc/disambiguate-anchors-32890.rs b/tests/rustdoc/disambiguate-anchors-32890.rs new file mode 100644 index 000000000..d88601d65 --- /dev/null +++ b/tests/rustdoc/disambiguate-anchors-32890.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/32890 +#![crate_name="issue_32890"] + +// @has issue_32890/struct.Foo.html +pub struct Foo<T>(T); + +impl Foo<u8> { + // @has - '//a[@href="#method.pass"]' 'pass' + pub fn pass() {} +} + +impl Foo<u16> { + // @has - '//a[@href="#method.pass-1"]' 'pass' + pub fn pass() {} +} + +impl Foo<u32> { + // @has - '//a[@href="#method.pass-2"]' 'pass' + pub fn pass() {} +} diff --git a/tests/rustdoc/disambiguate-anchors-header-29449.rs b/tests/rustdoc/disambiguate-anchors-header-29449.rs new file mode 100644 index 000000000..38a4954fc --- /dev/null +++ b/tests/rustdoc/disambiguate-anchors-header-29449.rs @@ -0,0 +1,23 @@ +// https://github.com/rust-lang/rust/issues/29449 +#![crate_name="issue_29449"] + +// @has issue_29449/struct.Foo.html +pub struct Foo; + +impl Foo { + // @has - '//*[@id="examples"]//a' 'Examples' + // @has - '//*[@id="panics"]//a' 'Panics' + /// # Examples + /// # Panics + pub fn bar() {} + + // @has - '//*[@id="examples-1"]//a' 'Examples' + /// # Examples + pub fn bar_1() {} + + // @has - '//*[@id="examples-2"]//a' 'Examples' + // @has - '//*[@id="panics-1"]//a' 'Panics' + /// # Examples + /// # Panics + pub fn bar_2() {} +} diff --git a/tests/rustdoc/doc-hidden-trait-implementors-33069.rs b/tests/rustdoc/doc-hidden-trait-implementors-33069.rs new file mode 100644 index 000000000..35570668e --- /dev/null +++ b/tests/rustdoc/doc-hidden-trait-implementors-33069.rs @@ -0,0 +1,13 @@ +// https://github.com/rust-lang/rust/issues/33069 +#![crate_name="issue_33069"] + +pub trait Bar {} + +#[doc(hidden)] +pub mod hidden { + pub struct Foo; +} + +// @has issue_33069/trait.Bar.html +// @!has - '//code' 'impl Bar for Foo' +impl Bar for hidden::Foo {} diff --git a/tests/rustdoc/doctest-cfg-feature-30252.rs b/tests/rustdoc/doctest-cfg-feature-30252.rs new file mode 100644 index 000000000..ceb8076fe --- /dev/null +++ b/tests/rustdoc/doctest-cfg-feature-30252.rs @@ -0,0 +1,9 @@ +// compile-flags:--test --cfg feature="bar" + +// https://github.com/rust-lang/rust/issues/30252 +#![crate_name="issue_30252"] + +/// ```rust +/// assert_eq!(cfg!(feature = "bar"), true); +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc/doctest-hide-empty-line-23106.rs b/tests/rustdoc/doctest-hide-empty-line-23106.rs new file mode 100644 index 000000000..8e1e2cf09 --- /dev/null +++ b/tests/rustdoc/doctest-hide-empty-line-23106.rs @@ -0,0 +1,10 @@ +// compile-flags:--test + +// https://github.com/rust-lang/rust/issues/23106 +#![crate_name="issue_23106"] + +/// ``` +/// # +/// ``` +pub fn main() { +} diff --git a/tests/rustdoc/doctest-ignore-32556.rs b/tests/rustdoc/doctest-ignore-32556.rs new file mode 100644 index 000000000..99da9358b --- /dev/null +++ b/tests/rustdoc/doctest-ignore-32556.rs @@ -0,0 +1,8 @@ +// https://github.com/rust-lang/rust/issues/32556 +#![crate_name="issue_32556"] + +/// Blah blah blah +/// ```ignore (testing rustdoc's handling of ignore) +/// bad_assert!(); +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc/doctest-markdown-inline-parse-23744.rs b/tests/rustdoc/doctest-markdown-inline-parse-23744.rs new file mode 100644 index 000000000..128e2daba --- /dev/null +++ b/tests/rustdoc/doctest-markdown-inline-parse-23744.rs @@ -0,0 +1,15 @@ +// compile-flags:--test + +// https://github.com/rust-lang/rust/issues/23744 +#![crate_name="issue_23744"] + +/// Example of rustdoc incorrectly parsing <code>```rust,should_panic</code>. +/// +/// ```should_panic +/// fn main() { panic!("fee"); } +/// ``` +/// +/// ```rust,should_panic +/// fn main() { panic!("fum"); } +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc/doctest-multi-line-string-literal-25944.rs b/tests/rustdoc/doctest-multi-line-string-literal-25944.rs new file mode 100644 index 000000000..eec796e4f --- /dev/null +++ b/tests/rustdoc/doctest-multi-line-string-literal-25944.rs @@ -0,0 +1,14 @@ +// compile-flags:--test + +// https://github.com/rust-lang/rust/issues/25944 +#![crate_name="issue_25944"] + +/// ``` +/// let a = r#" +/// foo +/// bar"#; +/// let b = "\nfoo\nbar"; +/// assert_eq!(a, b); +/// ``` +pub fn main() { +} diff --git a/tests/rustdoc/enum-variant-value.rs b/tests/rustdoc/enum-variant-value.rs new file mode 100644 index 000000000..096f8cd41 --- /dev/null +++ b/tests/rustdoc/enum-variant-value.rs @@ -0,0 +1,191 @@ +// This test ensures that the variant value is displayed with underscores but without +// a type name at the end. + +// aux-build:enum-variant.rs + +#![crate_name = "foo"] + +extern crate bar; + +// In this case, since all variants are C-like variants and at least one of them +// has its value set, we display values for all of them. + +// @has 'foo/enum.A.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 12,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 13,' +// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 12$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 13$' +// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$' +pub enum A { + A = 12, + B, + C = 1245, +} + +// In this case, all variants are C-like variants but none of them has its value set. +// Therefore we don't display values. + +// @has 'foo/enum.B.html' +// @has - '//*[@class="rust item-decl"]/code' 'A,' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @matches - '//*[@id="variant.A"]/h3' '^A$' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +pub enum B { + A, + B, +} + +// In this case, not all variants are C-like variants so we don't display values. + +// @has 'foo/enum.C.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 12,' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@class="rust item-decl"]/code' 'C(u32),' +// @matches - '//*[@id="variant.A"]/h3' '^A = 12$' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +// @has - '//*[@id="variant.C"]/h3' 'C(u32)' +#[repr(u32)] +pub enum C { + A = 12, + B, + C(u32), +} + +// In this case, not all variants are C-like variants and no C-like variant has its +// value set, so we don't display values. + +// @has 'foo/enum.D.html' +// @has - '//*[@class="rust item-decl"]/code' 'A,' +// @has - '//*[@class="rust item-decl"]/code' 'C(u32),' +// @matches - '//*[@id="variant.A"]/h3' '^A$' +// @has - '//*[@id="variant.C"]/h3' 'C(u32)' +pub enum D { + A, + C(u32), +} + +// @has 'foo/enum.E.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 12,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 13,' +// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 12$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 13$' +// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$' +pub use bar::E; + +// @has 'foo/enum.F.html' +// @has - '//*[@class="rust item-decl"]/code' 'A,' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @matches - '//*[@id="variant.A"]/h3' '^A$' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +pub use bar::F; + +// @has 'foo/enum.G.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 12,' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@class="rust item-decl"]/code' 'C(u32),' +// @matches - '//*[@id="variant.A"]/h3' '^A = 12$' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +// @has - '//*[@id="variant.C"]/h3' 'C(u32)' +pub use bar::G; + +// @has 'foo/enum.H.html' +// @has - '//*[@class="rust item-decl"]/code' 'A,' +// @has - '//*[@class="rust item-decl"]/code' 'C(u32),' +// @matches - '//*[@id="variant.A"]/h3' '^A$' +// @has - '//*[@id="variant.C"]/h3' 'C(u32)' +pub use bar::H; + +// Testing more complex cases. +pub const X: isize = 2; +// @has 'foo/enum.I.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 2,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 4,' +// @has - '//*[@class="rust item-decl"]/code' 'C = 9,' +// @has - '//*[@class="rust item-decl"]/code' 'D = -1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 2$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 4$' +// @matches - '//*[@id="variant.C"]/h3' '^C = 9$' +// @matches - '//*[@id="variant.D"]/h3' '^D = -1$' +#[repr(isize)] +pub enum I { + A = X, + B = X * 2, + C = Self::B as isize + X + 3, + D = -1, +} + +// Testing `repr`. + +// @has 'foo/enum.J.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 0,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 0$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 1$' +#[repr(C)] +pub enum J { + A, + B, +} + +// @has 'foo/enum.K.html' +// @has - '//*[@class="rust item-decl"]/code' 'A(u32),' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@id="variant.A"]/h3' 'A(u32)' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +#[repr(C)] +pub enum K { + A(u32), + B, +} + +// @has 'foo/enum.L.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 0,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 0$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 1$' +#[repr(u32)] +pub enum L { + A, + B, +} + +// @has 'foo/enum.M.html' +// @has - '//*[@class="rust item-decl"]/code' 'A(u32),' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@id="variant.A"]/h3' 'A(u32)' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +#[repr(u32)] +pub enum M { + A(u32), + B, +} + +// @has 'foo/enum.N.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 0,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 0$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 1$' +pub use bar::N; + +// @has 'foo/enum.O.html' +// @has - '//*[@class="rust item-decl"]/code' 'A(u32),' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@id="variant.A"]/h3' 'A(u32)' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +pub use bar::O; + +// @has 'foo/enum.P.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 0,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 0$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 1$' +pub use bar::P; + +// @has 'foo/enum.Q.html' +// @has - '//*[@class="rust item-decl"]/code' 'A(u32),' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@id="variant.A"]/h3' 'A(u32)' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +pub use bar::Q; diff --git a/tests/rustdoc/extern-fn-22038.rs b/tests/rustdoc/extern-fn-22038.rs new file mode 100644 index 000000000..72d39c32a --- /dev/null +++ b/tests/rustdoc/extern-fn-22038.rs @@ -0,0 +1,22 @@ +// https://github.com/rust-lang/rust/issues/22038 +#![crate_name="issue_22038"] + +extern "C" { + // @has issue_22038/fn.foo1.html \ + // '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn foo1()' + pub fn foo1(); +} + +extern "system" { + // @has issue_22038/fn.foo2.html \ + // '//pre[@class="rust item-decl"]' 'pub unsafe extern "system" fn foo2()' + pub fn foo2(); +} + +// @has issue_22038/fn.bar.html \ +// '//pre[@class="rust item-decl"]' 'pub extern "C" fn bar()' +pub extern "C" fn bar() {} + +// @has issue_22038/fn.baz.html \ +// '//pre[@class="rust item-decl"]' 'pub extern "system" fn baz()' +pub extern "system" fn baz() {} diff --git a/tests/rustdoc/generic-impl.rs b/tests/rustdoc/generic-impl.rs index 6f68b1574..f62540c6b 100644 --- a/tests/rustdoc/generic-impl.rs +++ b/tests/rustdoc/generic-impl.rs @@ -5,9 +5,9 @@ use std::fmt; // @!has foo/struct.Bar.html '//*[@id="impl-ToString-for-Bar"]' '' pub struct Bar; -// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-Foo"]//h3[@class="code-header"]' 'impl<T> ToString for T' +// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-T"]//h3[@class="code-header"]' 'impl<T> ToString for T' pub struct Foo; -// @has foo/struct.Foo.html '//*[@class="sidebar-elems"]//section//a[@href="#impl-ToString-for-Foo"]' 'ToString' +// @has foo/struct.Foo.html '//*[@class="sidebar-elems"]//section//a[@href="#impl-ToString-for-T"]' 'ToString' impl fmt::Display for Foo { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/tests/rustdoc/hidden-extern-34025.rs b/tests/rustdoc/hidden-extern-34025.rs new file mode 100644 index 000000000..81ccf2a0e --- /dev/null +++ b/tests/rustdoc/hidden-extern-34025.rs @@ -0,0 +1,13 @@ +// https://github.com/rust-lang/rust/issues/34025 +#![crate_name = "foo"] + +// @!has 'foo/sys/index.html' +// @!has 'foo/sys/sidebar-items.js' +#[doc(hidden)] +pub mod sys { + extern "C" { + // @!has 'foo/sys/fn.foo.html' + #[doc(hidden)] + pub fn foo(); + } +} diff --git a/tests/rustdoc/hidden-impls.rs b/tests/rustdoc/hidden-impls.rs index 26e2e0e06..3283fbfec 100644 --- a/tests/rustdoc/hidden-impls.rs +++ b/tests/rustdoc/hidden-impls.rs @@ -12,6 +12,6 @@ pub mod __hidden { // @has foo/trait.Clone.html // @!hasraw - 'Foo' -// @has implementors/core/clone/trait.Clone.js +// @has trait.impl/core/clone/trait.Clone.js // @!hasraw - 'Foo' pub use std::clone::Clone; diff --git a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs index 6006354eb..d728f772a 100644 --- a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs +++ b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs @@ -4,9 +4,11 @@ // // Read the documentation of `rustdoc::clean::utils::print_const_expr` // for further details. -#![feature(const_trait_impl, generic_const_exprs)] +#![feature(const_trait_impl, generic_const_exprs, adt_const_params, generic_const_items)] #![allow(incomplete_features)] +use std::marker::ConstParamTy; + // @has hide_complex_unevaluated_const_arguments/trait.Stage.html pub trait Stage { // A helper constant that prevents const expressions containing it @@ -29,11 +31,13 @@ pub trait Stage { // // @has - '//*[@id="associatedconstant.ARRAY1"]' \ // 'const ARRAY1: [u8; { _ }]' - const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]; + const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)] + where [(); Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]:; // @has - '//*[@id="associatedconstant.VERBOSE"]' \ // 'const VERBOSE: [u16; { _ }]' - const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT]; + const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT] + where [(); compute("thing", 9 + 9) * Self::ABSTRACT]:; // Check that we do not leak the private struct field contained within // the path. The output could definitely be improved upon @@ -69,6 +73,7 @@ pub trait Sub: Sup<{ 90 * 20 * 4 }, { Struct { private: () } }> {} pub trait Sup<const N: usize, const S: Struct> {} +#[derive(ConstParamTy, PartialEq, Eq)] pub struct Struct { private: () } impl Struct { diff --git a/tests/rustdoc/html-no-source.rs b/tests/rustdoc/html-no-source.rs index 25615a73c..b91aa4120 100644 --- a/tests/rustdoc/html-no-source.rs +++ b/tests/rustdoc/html-no-source.rs @@ -11,20 +11,20 @@ // @files 'src/foo' '[]' // @has foo/fn.foo.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' -// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub fn foo() {} // @has foo/struct.Bar.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' -// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub struct Bar; impl Bar { - // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0' - // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·' + // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0.0' + // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0.0 ·' #[stable(feature = "foobar", since = "2.0")] pub fn bar() {} } diff --git a/tests/rustdoc/ice-reexport-crate-root-28927.rs b/tests/rustdoc/ice-reexport-crate-root-28927.rs new file mode 100644 index 000000000..26debfc60 --- /dev/null +++ b/tests/rustdoc/ice-reexport-crate-root-28927.rs @@ -0,0 +1,9 @@ +// aux-build:issue-28927-2.rs +// aux-build:issue-28927-1.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/28927 +#![crate_name="issue_28927"] + +pub extern crate issue_28927_1 as inner1; +pub use inner1 as foo; diff --git a/tests/rustdoc/impl-assoc-type-21092.rs b/tests/rustdoc/impl-assoc-type-21092.rs new file mode 100644 index 000000000..f01f098a9 --- /dev/null +++ b/tests/rustdoc/impl-assoc-type-21092.rs @@ -0,0 +1,11 @@ +// aux-build:issue-21092.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/21092 +#![crate_name="issue_21092"] + +extern crate issue_21092; + +// @has issue_21092/struct.Bar.html +// @has - '//*[@id="associatedtype.Bar"]' 'type Bar = i32' +pub use issue_21092::{Foo, Bar}; diff --git a/tests/rustdoc/impl-parts-crosscrate.rs b/tests/rustdoc/impl-parts-crosscrate.rs index 34733f1f8..da109ea70 100644 --- a/tests/rustdoc/impl-parts-crosscrate.rs +++ b/tests/rustdoc/impl-parts-crosscrate.rs @@ -12,7 +12,7 @@ pub struct Bar<T> { t: T } // full impl string. Instead, just make sure something from each part // is mentioned. -// @hasraw implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar +// @hasraw trait.impl/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar // @hasraw - Send // @hasraw - !AnAutoTrait // @hasraw - Copy diff --git a/tests/rustdoc/impl-type-parameter-33592.rs b/tests/rustdoc/impl-type-parameter-33592.rs new file mode 100644 index 000000000..77f53710e --- /dev/null +++ b/tests/rustdoc/impl-type-parameter-33592.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/33592 +#![crate_name = "foo"] + +pub trait Foo<T> {} + +pub struct Bar; + +pub struct Baz; + +// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl Foo<i32> for Bar' +impl Foo<i32> for Bar {} + +// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl<T> Foo<T> for Baz' +impl<T> Foo<T> for Baz {} diff --git a/tests/rustdoc/implementor-stable-version.rs b/tests/rustdoc/implementor-stable-version.rs index a1f3fd5a8..9c5b9b7e3 100644 --- a/tests/rustdoc/implementor-stable-version.rs +++ b/tests/rustdoc/implementor-stable-version.rs @@ -1,21 +1,21 @@ -#![stable(feature = "bar", since = "OLD 1.0")] +#![stable(feature = "bar", since = "3.3.3")] #![crate_name = "foo"] #![feature(staged_api)] -#[stable(feature = "bar", since = "OLD 1.0")] +#[stable(feature = "bar", since = "3.3.3")] pub trait Bar {} -#[stable(feature = "baz", since = "OLD 1.0")] +#[stable(feature = "baz", since = "3.3.3")] pub trait Baz {} -#[stable(feature = "baz", since = "OLD 1.0")] +#[stable(feature = "baz", since = "3.3.3")] pub struct Foo; -// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' 'NEW 2.0' -#[stable(feature = "foobar", since = "NEW 2.0")] +// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' '4.4.4' +#[stable(feature = "foobar", since = "4.4.4")] impl Bar for Foo {} -// @!has foo/trait.Baz.html '//div[@id="implementors-list"]//span[@class="since"]' 'OLD 1.0' -#[stable(feature = "foobaz", since = "OLD 1.0")] +// @!has foo/trait.Baz.html '//div[@id="implementors-list"]//span[@class="since"]' '3.3.3' +#[stable(feature = "foobaz", since = "3.3.3")] impl Baz for Foo {} diff --git a/tests/rustdoc/inline_cross/attributes.rs b/tests/rustdoc/inline_cross/attributes.rs new file mode 100644 index 000000000..c0b75c48f --- /dev/null +++ b/tests/rustdoc/inline_cross/attributes.rs @@ -0,0 +1,7 @@ +// aux-crate:attributes=attributes.rs +// edition:2021 +#![crate_name = "user"] + +// @has 'user/struct.NonExhaustive.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[non_exhaustive]' +pub use attributes::NonExhaustive; diff --git a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs index 767564ed1..564ca7d67 100644 --- a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs +++ b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs @@ -1,4 +1,3 @@ -#![feature(async_fn_in_trait)] // edition: 2021 pub async fn load() -> i32 { diff --git a/tests/rustdoc/inline_cross/auxiliary/attributes.rs b/tests/rustdoc/inline_cross/auxiliary/attributes.rs new file mode 100644 index 000000000..c6f155d4b --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/attributes.rs @@ -0,0 +1,2 @@ +#[non_exhaustive] +pub struct NonExhaustive; diff --git a/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs b/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs new file mode 100644 index 000000000..b0c21ffae --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs @@ -0,0 +1,16 @@ +#![feature(effects, const_trait_impl)] + +#[const_trait] +pub trait Resource {} + +pub const fn load<R: ~const Resource>() -> i32 { + 0 +} + +pub const fn lock<R: Resource>() {} + +#[allow(non_upper_case_globals)] +pub trait Clash<const host: u64> {} + +#[allow(non_upper_case_globals)] +pub const fn clash<T: Clash<host>, const host: u64>() {} diff --git a/tests/rustdoc/inline_cross/auxiliary/const-fn.rs b/tests/rustdoc/inline_cross/auxiliary/const-fn.rs deleted file mode 100644 index 26332b419..000000000 --- a/tests/rustdoc/inline_cross/auxiliary/const-fn.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![feature(effects)] - -pub const fn load() -> i32 { - 0 -} diff --git a/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs b/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs new file mode 100644 index 000000000..1e31f1892 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs @@ -0,0 +1,45 @@ +pub type BoxedStr = Box<str>; +pub type IntMap = std::collections::HashMap<i64, u64>; + +pub struct TyPair<T, U = T>(T, U); + +pub type T0 = TyPair<i32>; +pub type T1 = TyPair<i32, u32>; +pub type T2<K> = TyPair<i32, K>; +pub type T3<Q> = TyPair<Q, Q>; + +pub struct CtPair<const C: u32, const D: u32 = C>; + +pub type C0 = CtPair<43, 43>; +pub type C1 = CtPair<0, 1>; +pub type C2 = CtPair<{1 + 2}, 3>; + +pub struct Re<'a, U = &'a ()>(&'a (), U); + +pub type R0<'q> = Re<'q>; +pub type R1<'q> = Re<'q, &'q ()>; +pub type R2<'q> = Re<'q, &'static ()>; +pub type H0 = fn(for<'a> fn(Re<'a>)); +pub type H1 = for<'b> fn(for<'a> fn(Re<'a, &'b ()>)); +pub type H2 = for<'a> fn(for<'b> fn(Re<'a, &'b ()>)); + +pub struct Proj<T: Basis, U = <T as Basis>::Assoc>(T, U); +pub trait Basis { type Assoc; } +impl Basis for () { type Assoc = bool; } + +pub type P0 = Proj<()>; +pub type P1 = Proj<(), bool>; +pub type P2 = Proj<(), ()>; + +pub struct Alpha<T = for<'any> fn(&'any ())>(T); + +pub type A0 = Alpha; +pub type A1 = Alpha<for<'arbitrary> fn(&'arbitrary ())>; + +pub struct Multi<A = u64, B = u64>(A, B); + +pub type M0 = Multi<u64, ()>; + +pub trait Trait<'a, T = &'a ()> {} + +pub type F = dyn for<'a> Trait<'a>; diff --git a/tests/rustdoc/inline_cross/auxiliary/fn-type.rs b/tests/rustdoc/inline_cross/auxiliary/fn-type.rs new file mode 100644 index 000000000..dacda516b --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/fn-type.rs @@ -0,0 +1 @@ +pub type F = for<'z, 'a, '_unused> fn(&'z for<'b> fn(&'b str), &'a ()) -> &'a (); diff --git a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs index 42cfc3dc3..fa61312eb 100644 --- a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs +++ b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs @@ -15,7 +15,7 @@ pub fn func4<T: Iterator<Item = impl Clone>>(_x: T) {} pub fn func5( _f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>, - _a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>, + _a: impl for<'beta, 'alpha, '_gamma> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>, ) {} pub trait Other { diff --git a/tests/rustdoc/auxiliary/issue-21801.rs b/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs index 732612ff0..732612ff0 100644 --- a/tests/rustdoc/auxiliary/issue-21801.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs diff --git a/tests/rustdoc/auxiliary/issue-23207-1.rs b/tests/rustdoc/inline_cross/auxiliary/issue-23207-1.rs index 8531d5f1a..8531d5f1a 100644 --- a/tests/rustdoc/auxiliary/issue-23207-1.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-23207-1.rs diff --git a/tests/rustdoc/auxiliary/issue-23207-2.rs b/tests/rustdoc/inline_cross/auxiliary/issue-23207-2.rs index b92b16653..b92b16653 100644 --- a/tests/rustdoc/auxiliary/issue-23207-2.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-23207-2.rs diff --git a/tests/rustdoc/auxiliary/issue-27362-aux.rs b/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs index 077bdc33e..077bdc33e 100644 --- a/tests/rustdoc/auxiliary/issue-27362-aux.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs diff --git a/tests/rustdoc/auxiliary/issue-29584.rs b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs index a9b8796c0..a9b8796c0 100644 --- a/tests/rustdoc/auxiliary/issue-29584.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs diff --git a/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs b/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs new file mode 100644 index 000000000..9170be168 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs @@ -0,0 +1,10 @@ +#![feature(non_lifetime_binders)] + +pub trait Trait<T> {} + +pub fn f(_: impl for<T> Trait<T>) {} + +pub fn g<T>(_: T) +where + T: for<U> Trait<U>, +{} diff --git a/tests/rustdoc/inline_cross/auxiliary/repr.rs b/tests/rustdoc/inline_cross/auxiliary/repr.rs index 4a6648a64..35f08c11b 100644 --- a/tests/rustdoc/inline_cross/auxiliary/repr.rs +++ b/tests/rustdoc/inline_cross/auxiliary/repr.rs @@ -10,7 +10,7 @@ pub struct ReprSimd { } #[repr(transparent)] pub struct ReprTransparent { - field: u8, + pub field: u8, } #[repr(isize)] pub enum ReprIsize { @@ -20,3 +20,23 @@ pub enum ReprIsize { pub enum ReprU8 { Bla, } + +#[repr(transparent)] // private +pub struct ReprTransparentPrivField { + field: u32, // non-1-ZST field +} + +#[repr(transparent)] // public +pub struct ReprTransparentPriv1ZstFields { + marker0: Marker, + pub main: u64, // non-1-ZST field + marker1: Marker, +} + +#[repr(transparent)] // private +pub struct ReprTransparentPrivFieldPub1ZstFields { + main: [u16; 0], // non-1-ZST field + pub marker: Marker, +} + +pub struct Marker; // 1-ZST diff --git a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs index c72f01115..08a3f5176 100644 --- a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs +++ b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs @@ -1,5 +1,3 @@ -#![feature(return_position_impl_trait_in_trait)] - pub trait Trait { fn create() -> impl Iterator<Item = u64> { std::iter::empty() diff --git a/tests/rustdoc/inline_cross/const-effect-param.rs b/tests/rustdoc/inline_cross/const-effect-param.rs new file mode 100644 index 000000000..1d003e28f --- /dev/null +++ b/tests/rustdoc/inline_cross/const-effect-param.rs @@ -0,0 +1,29 @@ +// Regression test for issue #116629. +// Check that we don't render host effect parameters & arguments. + +// aux-crate:const_effect_param=const-effect-param.rs +// edition: 2021 +#![crate_name = "user"] + +// Don't render the host param on `load` and the host arg `host` passed to `Resource`. +// @has user/fn.load.html +// @has - '//pre[@class="rust item-decl"]' "pub const fn load<R>() -> i32\ +// where \ +// R: Resource" +pub use const_effect_param::load; + +// Don't render the host arg `true` passed to `Resource`. +// @has user/fn.lock.html +// @has - '//pre[@class="rust item-decl"]' "pub const fn lock<R>()\ +// where \ +// R: Resource" +pub use const_effect_param::lock; + +// Regression test for an issue introduced in PR #116670. +// Don't hide the const param `host` since it actually isn't the host effect param. +// @has user/fn.clash.html +// @has - '//pre[@class="rust item-decl"]' \ +// "pub const fn clash<T, const host: u64>()\ +// where \ +// T: Clash<host>" +pub use const_effect_param::clash; diff --git a/tests/rustdoc/inline_cross/const-fn-27362.rs b/tests/rustdoc/inline_cross/const-fn-27362.rs new file mode 100644 index 000000000..39b904662 --- /dev/null +++ b/tests/rustdoc/inline_cross/const-fn-27362.rs @@ -0,0 +1,13 @@ +// aux-build:issue-27362-aux.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/27362 +#![crate_name="issue_27362"] + +extern crate issue_27362_aux; + +pub use issue_27362_aux::*; + +// @matches issue_27362/fn.foo.html '//pre' "pub const fn foo()" +// @matches issue_27362/fn.bar.html '//pre' "pub const unsafe fn bar()" +// @matches issue_27362/struct.Foo.html '//h4[@class="code-header"]' "const unsafe fn baz()" diff --git a/tests/rustdoc/inline_cross/const-fn.rs b/tests/rustdoc/inline_cross/const-fn.rs deleted file mode 100644 index 24934b873..000000000 --- a/tests/rustdoc/inline_cross/const-fn.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Regression test for issue #116629. -// Check that we render the correct generic params of const fn - -// aux-crate:const_fn=const-fn.rs -// edition: 2021 -#![crate_name = "user"] - -// @has user/fn.load.html -// @has - '//pre[@class="rust item-decl"]' "pub const fn load() -> i32" -pub use const_fn::load; diff --git a/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs b/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs new file mode 100644 index 000000000..4e9596db5 --- /dev/null +++ b/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs @@ -0,0 +1,12 @@ +// aux-build:issue-23207-1.rs +// aux-build:issue-23207-2.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/23207 +#![crate_name="issue_23207"] + +extern crate issue_23207_2; + +// @has issue_23207/fmt/index.html +// @count - '//*[@class="struct"]' 1 +pub use issue_23207_2::fmt; diff --git a/tests/rustdoc/inline_cross/default-generic-args.rs b/tests/rustdoc/inline_cross/default-generic-args.rs new file mode 100644 index 000000000..c9a87a199 --- /dev/null +++ b/tests/rustdoc/inline_cross/default-generic-args.rs @@ -0,0 +1,104 @@ +#![crate_name = "user"] +// aux-crate:default_generic_args=default-generic-args.rs +// edition:2021 + +// @has user/type.BoxedStr.html +// @has - '//*[@class="rust item-decl"]//code' "Box<str>" +pub use default_generic_args::BoxedStr; + +// @has user/type.IntMap.html +// @has - '//*[@class="rust item-decl"]//code' "HashMap<i64, u64>" +pub use default_generic_args::IntMap; + +// @has user/type.T0.html +// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32>" +pub use default_generic_args::T0; + +// @has user/type.T1.html +// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32, u32>" +pub use default_generic_args::T1; + +// @has user/type.T2.html +// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32, K>" +pub use default_generic_args::T2; + +// @has user/type.T3.html +// @has - '//*[@class="rust item-decl"]//code' "TyPair<Q>" +pub use default_generic_args::T3; + +// @has user/type.C0.html +// @has - '//*[@class="rust item-decl"]//code' "CtPair<43>" +pub use default_generic_args::C0; + +// @has user/type.C1.html +// @has - '//*[@class="rust item-decl"]//code' "CtPair<0, 1>" +pub use default_generic_args::C1; + +// @has user/type.C2.html +// @has - '//*[@class="rust item-decl"]//code' "CtPair<default_generic_args::::C2::{constant#0}, 3>" +pub use default_generic_args::C2; + +// @has user/type.R0.html +// @has - '//*[@class="rust item-decl"]//code' "Re<'q>" +pub use default_generic_args::R0; + +// @has user/type.R1.html +// @has - '//*[@class="rust item-decl"]//code' "Re<'q>" +pub use default_generic_args::R1; + +// @has user/type.R2.html +// Check that we consider regions: +// @has - '//*[@class="rust item-decl"]//code' "Re<'q, &'static ()>" +pub use default_generic_args::R2; + +// @has user/type.H0.html +// Check that we handle higher-ranked regions correctly: +// @has - '//*[@class="rust item-decl"]//code' "fn(_: for<'a> fn(_: Re<'a>))" +pub use default_generic_args::H0; + +// @has user/type.H1.html +// Check that we don't conflate distinct universially quantified regions (#1): +// @has - '//*[@class="rust item-decl"]//code' "for<'b> fn(_: for<'a> fn(_: Re<'a, &'b ()>))" +pub use default_generic_args::H1; + +// @has user/type.H2.html +// Check that we don't conflate distinct universially quantified regions (#2): +// @has - '//*[@class="rust item-decl"]//code' "for<'a> fn(_: for<'b> fn(_: Re<'a, &'b ()>))" +pub use default_generic_args::H2; + +// @has user/type.P0.html +// @has - '//*[@class="rust item-decl"]//code' "Proj<()>" +pub use default_generic_args::P0; + +// @has user/type.P1.html +// @has - '//*[@class="rust item-decl"]//code' "Proj<(), bool>" +pub use default_generic_args::P1; + +// @has user/type.P2.html +// @has - '//*[@class="rust item-decl"]//code' "Proj<(), ()>" +pub use default_generic_args::P2; + +// @has user/type.A0.html +// Ensure that we elide generic arguments that are alpha-equivalent to their respective +// generic parameter (modulo substs) (#1): +// @has - '//*[@class="rust item-decl"]//code' "Alpha" +pub use default_generic_args::A0; + +// @has user/type.A1.html +// Ensure that we elide generic arguments that are alpha-equivalent to their respective +// generic parameter (modulo substs) (#1): +// @has - '//*[@class="rust item-decl"]//code' "Alpha" +pub use default_generic_args::A1; + +// @has user/type.M0.html +// Test that we don't elide `u64` even if it coincides with `A`'s default precisely because +// `()` is not the default of `B`. Mindlessly eliding `u64` would lead to `M<()>` which is a +// different type (`M<(), u64>` versus `M<u64, ()>`). +// @has - '//*[@class="rust item-decl"]//code' "Multi<u64, ()>" +pub use default_generic_args::M0; + +// @has user/type.F.html +// FIXME: Ideally, we would elide `&'a ()` but `'a` is an escaping bound var which we can't reason +// about at the moment since we don't keep track of bound vars. +// @has - '//*[@class="rust item-decl"]//code' "dyn for<'a> Trait<'a, &'a ()>" +pub use default_generic_args::F; diff --git a/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs new file mode 100644 index 000000000..b246e94e0 --- /dev/null +++ b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs @@ -0,0 +1,11 @@ +// aux-build:issue-29584.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/29584 +#![crate_name="issue_29584"] + +extern crate issue_29584; + +// @has issue_29584/struct.Foo.html +// @!hasraw - 'impl Bar for' +pub use issue_29584::Foo; diff --git a/tests/rustdoc/inline_cross/dyn_trait.rs b/tests/rustdoc/inline_cross/dyn_trait.rs index 679972f03..9871be79c 100644 --- a/tests/rustdoc/inline_cross/dyn_trait.rs +++ b/tests/rustdoc/inline_cross/dyn_trait.rs @@ -75,16 +75,16 @@ pub use dyn_trait::AmbiguousBoundWrappedEarly1; pub use dyn_trait::AmbiguousBoundWrappedStatic; // @has user/type.NoBoundsWrappedDefaulted.html -// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait, Global>;" +// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait>;" pub use dyn_trait::NoBoundsWrappedDefaulted; // @has user/type.NoBoundsWrappedEarly.html -// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait + 'e, Global>;" +// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait + 'e>;" pub use dyn_trait::NoBoundsWrappedEarly; // @has user/fn.nbwl.html -// @has - '//pre[@class="rust item-decl"]' "nbwl<'l>(_: Box<dyn Trait + 'l, Global>)" +// @has - '//pre[@class="rust item-decl"]' "nbwl<'l>(_: Box<dyn Trait + 'l>)" pub use dyn_trait::no_bounds_wrapped_late as nbwl; // @has user/fn.nbwel.html -// @has - '//pre[@class="rust item-decl"]' "nbwel(_: Box<dyn Trait + '_, Global>)" +// @has - '//pre[@class="rust item-decl"]' "nbwel(_: Box<dyn Trait + '_>)" // NB: It might seem counterintuitive to display the explicitly elided lifetime `'_` here instead of // eliding it but this behavior is correct: The default is `'static` here which != `'_`. pub use dyn_trait::no_bounds_wrapped_elided as nbwel; diff --git a/tests/rustdoc/inline_cross/fn-type.rs b/tests/rustdoc/inline_cross/fn-type.rs new file mode 100644 index 000000000..e65790d3b --- /dev/null +++ b/tests/rustdoc/inline_cross/fn-type.rs @@ -0,0 +1,12 @@ +// Make sure that we print the higher-ranked parameters of cross-crate function pointer types. +// They should be rendered exactly as the user wrote it, i.e., in source order and with unused +// parameters present, not stripped. + +// aux-crate:fn_type=fn-type.rs +// edition: 2021 +#![crate_name = "user"] + +// @has user/type.F.html +// @has - '//*[@class="rust item-decl"]//code' \ +// "for<'z, 'a, '_unused> fn(_: &'z for<'b> fn(_: &'b str), _: &'a ()) -> &'a ();" +pub use fn_type::F; diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs index 5c802c514..3a2f5d160 100644 --- a/tests/rustdoc/inline_cross/impl_trait.rs +++ b/tests/rustdoc/inline_cross/impl_trait.rs @@ -4,7 +4,7 @@ extern crate impl_trait_aux; // @has impl_trait/fn.func.html -// @has - '//pre[@class="rust item-decl"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)" +// @has - '//pre[@class="rust item-decl"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)" // @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func; @@ -29,11 +29,11 @@ pub use impl_trait_aux::func4; // @has impl_trait/fn.func5.html // @has - '//pre[@class="rust item-decl"]' "func5(" // @has - '//pre[@class="rust item-decl"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>," -// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>" +// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'beta, 'alpha, '_gamma> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>" // @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func5; // @has impl_trait/struct.Foo.html -// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)" +// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)" // @!has - '//*[@id="method.method"]//h4[@class="code-header"]' 'where' pub use impl_trait_aux::Foo; diff --git a/tests/rustdoc/inline_cross/implementors-js.rs b/tests/rustdoc/inline_cross/implementors-js.rs index c79f05d8d..c17d52d0f 100644 --- a/tests/rustdoc/inline_cross/implementors-js.rs +++ b/tests/rustdoc/inline_cross/implementors-js.rs @@ -4,13 +4,13 @@ extern crate implementors_inline; -// @!has implementors/implementors_js/trait.MyTrait.js -// @has implementors/implementors_inline/my_trait/trait.MyTrait.js -// @!has implementors/implementors_inline/prelude/trait.MyTrait.js +// @!has trait.impl/implementors_js/trait.MyTrait.js +// @has trait.impl/implementors_inline/my_trait/trait.MyTrait.js +// @!has trait.impl/implementors_inline/prelude/trait.MyTrait.js // @has implementors_inline/my_trait/trait.MyTrait.html -// @has - '//script/@src' '../../implementors/implementors_inline/my_trait/trait.MyTrait.js' +// @has - '//script/@src' '../../trait.impl/implementors_inline/my_trait/trait.MyTrait.js' // @has implementors_js/trait.MyTrait.html -// @has - '//script/@src' '../implementors/implementors_inline/my_trait/trait.MyTrait.js' +// @has - '//script/@src' '../trait.impl/implementors_inline/my_trait/trait.MyTrait.js' /// When re-exporting this trait, the HTML will be inlined, /// but, vitally, the JavaScript will be located only at the /// one canonical path. diff --git a/tests/rustdoc/inline_cross/non_lifetime_binders.rs b/tests/rustdoc/inline_cross/non_lifetime_binders.rs new file mode 100644 index 000000000..9d3085c3e --- /dev/null +++ b/tests/rustdoc/inline_cross/non_lifetime_binders.rs @@ -0,0 +1,13 @@ +// aux-crate:non_lifetime_binders=non_lifetime_binders.rs +// edition: 2021 +#![crate_name = "user"] + +// @has user/fn.f.html +// @has - '//pre[@class="rust item-decl"]' "f(_: impl for<T> Trait<T>)" +pub use non_lifetime_binders::f; + +// @has user/fn.g.html +// @has - '//pre[@class="rust item-decl"]' "g<T>(_: T)\ +// where \ +// T: for<U> Trait<U>" +pub use non_lifetime_binders::g; diff --git a/tests/rustdoc/inline_cross/repr.rs b/tests/rustdoc/inline_cross/repr.rs index 9e107cee9..2f3d8f003 100644 --- a/tests/rustdoc/inline_cross/repr.rs +++ b/tests/rustdoc/inline_cross/repr.rs @@ -9,21 +9,32 @@ extern crate repr; // @has 'foo/struct.ReprC.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(C, align(8))]' -#[doc(inline)] pub use repr::ReprC; // @has 'foo/struct.ReprSimd.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(simd, packed(2))]' -#[doc(inline)] pub use repr::ReprSimd; // @has 'foo/struct.ReprTransparent.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' -#[doc(inline)] pub use repr::ReprTransparent; // @has 'foo/enum.ReprIsize.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(isize)]' -#[doc(inline)] pub use repr::ReprIsize; // @has 'foo/enum.ReprU8.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(u8)]' -#[doc(inline)] pub use repr::ReprU8; + +// Regression test for <https://github.com/rust-lang/rust/issues/90435>. +// Check that we show `#[repr(transparent)]` iff the non-1-ZST field is public or at least one +// field is public in case all fields are 1-ZST fields. + +// @has 'foo/struct.ReprTransparentPrivField.html' +// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +pub use repr::ReprTransparentPrivField; + +// @has 'foo/struct.ReprTransparentPriv1ZstFields.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +pub use repr::ReprTransparentPriv1ZstFields; + +// @has 'foo/struct.ReprTransparentPrivFieldPub1ZstFields.html' +// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +pub use repr::ReprTransparentPrivFieldPub1ZstFields; diff --git a/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs b/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs new file mode 100644 index 000000000..bcbb2e9f4 --- /dev/null +++ b/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs @@ -0,0 +1,12 @@ +// aux-build:issue-21801.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/21801 +#![crate_name="issue_21801"] + +extern crate issue_21801; + +// @has issue_21801/struct.Foo.html +// @has - '//*[@id="method.new"]' \ +// 'fn new<F>(f: F) -> Foowhere F: FnMut() -> i32' +pub use issue_21801::Foo; diff --git a/tests/rustdoc/intra-doc/prim-associated-traits.rs b/tests/rustdoc/intra-doc/prim-associated-traits.rs index 8639a24f7..71d7d2189 100644 --- a/tests/rustdoc/intra-doc/prim-associated-traits.rs +++ b/tests/rustdoc/intra-doc/prim-associated-traits.rs @@ -41,6 +41,6 @@ pub struct Number { pub u_128: u128, pub ch: char, pub boolean: bool, - pub string: str, + pub string: &'static str, pub n: !, } diff --git a/tests/rustdoc/issue-115295-macro-const-display.rs b/tests/rustdoc/issue-115295-macro-const-display.rs new file mode 100644 index 000000000..2916c7a84 --- /dev/null +++ b/tests/rustdoc/issue-115295-macro-const-display.rs @@ -0,0 +1,40 @@ +#![crate_name = "foo"] + +// @has foo/trait.Trait.html +pub trait Trait<T> {} + +// @has foo/struct.WithConst.html +pub struct WithConst<const N: usize>; + +macro_rules! spans_from_macro { + () => { + impl WithConst<42> { + pub fn new() -> Self { + Self + } + } + impl Trait<WithConst<42>> for WithConst<42> {} + impl Trait<WithConst<43>> for WithConst<{ 43 }> {} + impl Trait<WithConst<{ 44 }>> for WithConst<44> {} + pub struct Other { + pub field: WithConst<42>, + } + }; +} + +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Trait<WithConst<41>> for WithConst<41>" +impl Trait<WithConst<41>> for WithConst<41> {} + +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl WithConst<42>" +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Trait<WithConst<42>> for WithConst<42>" +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Trait<WithConst<43>> for WithConst<{ 43 }>" +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Trait<WithConst<44>> for WithConst<44>" + +// @has foo/struct.Other.html +// @has - //pre "pub field: WithConst<42>" +spans_from_macro!(); diff --git a/tests/rustdoc/issue-21092.rs b/tests/rustdoc/issue-21092.rs deleted file mode 100644 index b054145a4..000000000 --- a/tests/rustdoc/issue-21092.rs +++ /dev/null @@ -1,8 +0,0 @@ -// aux-build:issue-21092.rs -// ignore-cross-compile - -extern crate issue_21092; - -// @has issue_21092/struct.Bar.html -// @has - '//*[@id="associatedtype.Bar"]' 'type Bar = i32' -pub use issue_21092::{Foo, Bar}; diff --git a/tests/rustdoc/issue-21474.rs b/tests/rustdoc/issue-21474.rs deleted file mode 100644 index 5de26abac..000000000 --- a/tests/rustdoc/issue-21474.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub use inner::*; - -mod inner { - impl super::Blah for super::What { } -} - -pub trait Blah { } - -// @count issue_21474/struct.What.html \ -// '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 -pub struct What; diff --git a/tests/rustdoc/issue-21801.rs b/tests/rustdoc/issue-21801.rs deleted file mode 100644 index 29d2ec64c..000000000 --- a/tests/rustdoc/issue-21801.rs +++ /dev/null @@ -1,9 +0,0 @@ -// aux-build:issue-21801.rs -// ignore-cross-compile - -extern crate issue_21801; - -// @has issue_21801/struct.Foo.html -// @has - '//*[@id="method.new"]' \ -// 'fn new<F>(f: F) -> Foowhere F: FnMut() -> i32' -pub use issue_21801::Foo; diff --git a/tests/rustdoc/issue-22025.rs b/tests/rustdoc/issue-22025.rs deleted file mode 100644 index a721a15f4..000000000 --- a/tests/rustdoc/issue-22025.rs +++ /dev/null @@ -1,6 +0,0 @@ -// aux-build:issue-22025.rs -// ignore-cross-compile - -extern crate issue_22025; - -pub use issue_22025::foo::{Foo, Bar}; diff --git a/tests/rustdoc/issue-22038.rs b/tests/rustdoc/issue-22038.rs deleted file mode 100644 index de6cc7870..000000000 --- a/tests/rustdoc/issue-22038.rs +++ /dev/null @@ -1,19 +0,0 @@ -extern "C" { - // @has issue_22038/fn.foo1.html \ - // '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn foo1()' - pub fn foo1(); -} - -extern "system" { - // @has issue_22038/fn.foo2.html \ - // '//pre[@class="rust item-decl"]' 'pub unsafe extern "system" fn foo2()' - pub fn foo2(); -} - -// @has issue_22038/fn.bar.html \ -// '//pre[@class="rust item-decl"]' 'pub extern "C" fn bar()' -pub extern "C" fn bar() {} - -// @has issue_22038/fn.baz.html \ -// '//pre[@class="rust item-decl"]' 'pub extern "system" fn baz()' -pub extern "system" fn baz() {} diff --git a/tests/rustdoc/issue-23106.rs b/tests/rustdoc/issue-23106.rs deleted file mode 100644 index 8cda2fc33..000000000 --- a/tests/rustdoc/issue-23106.rs +++ /dev/null @@ -1,7 +0,0 @@ -// compile-flags:--test - -/// ``` -/// # -/// ``` -pub fn main() { -} diff --git a/tests/rustdoc/issue-23207.rs b/tests/rustdoc/issue-23207.rs deleted file mode 100644 index 1a4b849ee..000000000 --- a/tests/rustdoc/issue-23207.rs +++ /dev/null @@ -1,9 +0,0 @@ -// aux-build:issue-23207-1.rs -// aux-build:issue-23207-2.rs -// ignore-cross-compile - -extern crate issue_23207_2; - -// @has issue_23207/fmt/index.html -// @count - '//*[@class="struct"]' 1 -pub use issue_23207_2::fmt; diff --git a/tests/rustdoc/issue-23511.rs b/tests/rustdoc/issue-23511.rs deleted file mode 100644 index 21d028424..000000000 --- a/tests/rustdoc/issue-23511.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(rustc_attrs)] -#![feature(rustdoc_internals)] -#![no_std] - -pub mod str { - #![rustc_doc_primitive = "str"] - - impl str { - // @hasraw search-index.js foo - #[rustc_allow_incoherent_impl] - pub fn foo(&self) {} - } -} diff --git a/tests/rustdoc/issue-23744.rs b/tests/rustdoc/issue-23744.rs deleted file mode 100644 index 642817396..000000000 --- a/tests/rustdoc/issue-23744.rs +++ /dev/null @@ -1,12 +0,0 @@ -// compile-flags:--test - -/// Example of rustdoc incorrectly parsing <code>```rust,should_panic</code>. -/// -/// ```should_panic -/// fn main() { panic!("fee"); } -/// ``` -/// -/// ```rust,should_panic -/// fn main() { panic!("fum"); } -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc/issue-23812.rs b/tests/rustdoc/issue-23812.rs deleted file mode 100644 index 08fd1833b..000000000 --- a/tests/rustdoc/issue-23812.rs +++ /dev/null @@ -1,36 +0,0 @@ -macro_rules! doc { - (#[$outer:meta] mod $i:ident { #![$inner:meta] }) => - ( - #[$outer] - pub mod $i { - #![$inner] - } - ) -} - -doc! { - /// Outer comment - mod Foo { - //! Inner comment - } -} - -// @has issue_23812/Foo/index.html -// @hasraw - 'Outer comment' -// @!hasraw - '/// Outer comment' -// @hasraw - 'Inner comment' -// @!hasraw - '//! Inner comment' - - -doc! { - /** Outer block comment */ - mod Bar { - /*! Inner block comment */ - } -} - -// @has issue_23812/Bar/index.html -// @hasraw - 'Outer block comment' -// @!hasraw - '/** Outer block comment */' -// @hasraw - 'Inner block comment' -// @!hasraw - '/*! Inner block comment */' diff --git a/tests/rustdoc/issue-25001.rs b/tests/rustdoc/issue-25001.rs deleted file mode 100644 index 268fae594..000000000 --- a/tests/rustdoc/issue-25001.rs +++ /dev/null @@ -1,43 +0,0 @@ -// @has issue_25001/struct.Foo.html -pub struct Foo<T>(T); - -pub trait Bar { - type Item; - - fn quux(self); -} - -impl Foo<u8> { - // @has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()' - pub fn pass() {} -} -impl Foo<u16> { - // @has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize' - pub fn pass() -> usize { 42 } -} -impl Foo<u32> { - // @has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize' - pub fn pass() -> isize { 42 } -} - -impl<T> Bar for Foo<T> { - // @has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' 'type Item = T' - type Item=T; - - // @has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)' - fn quux(self) {} -} -impl<'a, T> Bar for &'a Foo<T> { - // @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item = &'a T" - type Item=&'a T; - - // @has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)' - fn quux(self) {} -} -impl<'a, T> Bar for &'a mut Foo<T> { - // @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T" - type Item=&'a mut T; - - // @has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)' - fn quux(self) {} -} diff --git a/tests/rustdoc/issue-25944.rs b/tests/rustdoc/issue-25944.rs deleted file mode 100644 index 49625294b..000000000 --- a/tests/rustdoc/issue-25944.rs +++ /dev/null @@ -1,11 +0,0 @@ -// compile-flags:--test - -/// ``` -/// let a = r#" -/// foo -/// bar"#; -/// let b = "\nfoo\nbar"; -/// assert_eq!(a, b); -/// ``` -pub fn main() { -} diff --git a/tests/rustdoc/issue-26606.rs b/tests/rustdoc/issue-26606.rs deleted file mode 100644 index d5cb2c710..000000000 --- a/tests/rustdoc/issue-26606.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:issue-26606-macro.rs -// ignore-cross-compile -// build-aux-docs - -// @has issue_26606_macro/macro.make_item.html -#[macro_use] -extern crate issue_26606_macro; - -// @has issue_26606/constant.FOO.html -// @has - '//a[@href="../src/issue_26606/issue-26606.rs.html#11"]' 'source' -make_item!(FOO); diff --git a/tests/rustdoc/issue-26995.rs b/tests/rustdoc/issue-26995.rs deleted file mode 100644 index fedc9f517..000000000 --- a/tests/rustdoc/issue-26995.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-windows -// compile-flags: --no-defaults - -// @has src/issue_26995/dev/null.html -// @has issue_26995/null/index.html '//a/@href' '../../src/issue_26995/dev/null.html' -#[path="/dev/null"] -pub mod null; diff --git a/tests/rustdoc/issue-27104.rs b/tests/rustdoc/issue-27104.rs deleted file mode 100644 index 9f2fd9071..000000000 --- a/tests/rustdoc/issue-27104.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags:--no-defaults --passes strip-priv-imports -// aux-build:empty.rs -// ignore-cross-compile - -// @has issue_27104/index.html -// @!hasraw - 'extern crate std' -// @!hasraw - 'use std::prelude::' - -// @hasraw - 'pub extern crate empty' -pub extern crate empty; diff --git a/tests/rustdoc/issue-27362.rs b/tests/rustdoc/issue-27362.rs deleted file mode 100644 index 097e4e3b0..000000000 --- a/tests/rustdoc/issue-27362.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:issue-27362-aux.rs -// ignore-cross-compile - -extern crate issue_27362_aux; - -pub use issue_27362_aux::*; - -// @matches issue_27362/fn.foo.html '//pre' "pub const fn foo()" -// @matches issue_27362/fn.bar.html '//pre' "pub const unsafe fn bar()" -// @matches issue_27362/struct.Foo.html '//h4[@class="code-header"]' "const unsafe fn baz()" diff --git a/tests/rustdoc/issue-27759.rs b/tests/rustdoc/issue-27759.rs deleted file mode 100644 index 65e0f7cb8..000000000 --- a/tests/rustdoc/issue-27759.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(staged_api)] -#![doc(issue_tracker_base_url = "http://issue_url/")] - -#![unstable(feature="test", issue="27759")] - -// @has issue_27759/unstable/index.html -// @hasraw - '<code>test</code> <a href="http://issue_url/27759">#27759</a>' -#[unstable(feature="test", issue="27759")] -pub mod unstable { - // @has issue_27759/unstable/fn.issue.html - // @hasraw - '<code>test_function</code> <a href="http://issue_url/12345">#12345</a>' - #[unstable(feature="test_function", issue="12345")] - pub fn issue() {} -} diff --git a/tests/rustdoc/issue-27862.rs b/tests/rustdoc/issue-27862.rs deleted file mode 100644 index 77522f1be..000000000 --- a/tests/rustdoc/issue-27862.rs +++ /dev/null @@ -1,4 +0,0 @@ -/// Tests | Table -/// ------|------------- -/// t = b | id = \|x\| x -pub struct Foo; // @has issue_27862/struct.Foo.html //td 'id = |x| x' diff --git a/tests/rustdoc/issue-28478.rs b/tests/rustdoc/issue-28478.rs deleted file mode 100644 index 497276e68..000000000 --- a/tests/rustdoc/issue-28478.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![feature(associated_type_defaults)] - -// @has issue_28478/trait.Bar.html -pub trait Bar { - // @has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()' - // @has - '//*[@href="#associatedtype.Bar"]' 'Bar' - type Bar = (); - // @has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize' - // @has - '//*[@href="#associatedconstant.Baz"]' 'Baz' - const Baz: usize = 7; - // @has - '//*[@id="tymethod.bar"]' 'fn bar' - fn bar(); - // @has - '//*[@id="method.baz"]' 'fn baz' - fn baz() { } -} - -// @has issue_28478/struct.Foo.html -pub struct Foo; - -impl Foo { - // @has - '//*[@href="#method.foo"]' 'foo' - pub fn foo() {} -} - -impl Bar for Foo { - // @has - '//*[@href="trait.Bar.html#associatedtype.Bar"]' 'Bar' - // @has - '//*[@href="trait.Bar.html#associatedconstant.Baz"]' 'Baz' - // @has - '//*[@href="trait.Bar.html#tymethod.bar"]' 'bar' - fn bar() {} - // @has - '//*[@href="trait.Bar.html#method.baz"]' 'baz' -} diff --git a/tests/rustdoc/issue-28927.rs b/tests/rustdoc/issue-28927.rs deleted file mode 100644 index 38a520850..000000000 --- a/tests/rustdoc/issue-28927.rs +++ /dev/null @@ -1,6 +0,0 @@ -// aux-build:issue-28927-2.rs -// aux-build:issue-28927-1.rs -// ignore-cross-compile - -pub extern crate issue_28927_1 as inner1; -pub use inner1 as foo; diff --git a/tests/rustdoc/issue-29449.rs b/tests/rustdoc/issue-29449.rs deleted file mode 100644 index 0d829cf6f..000000000 --- a/tests/rustdoc/issue-29449.rs +++ /dev/null @@ -1,20 +0,0 @@ -// @has issue_29449/struct.Foo.html -pub struct Foo; - -impl Foo { - // @has - '//*[@id="examples"]//a' 'Examples' - // @has - '//*[@id="panics"]//a' 'Panics' - /// # Examples - /// # Panics - pub fn bar() {} - - // @has - '//*[@id="examples-1"]//a' 'Examples' - /// # Examples - pub fn bar_1() {} - - // @has - '//*[@id="examples-2"]//a' 'Examples' - // @has - '//*[@id="panics-1"]//a' 'Panics' - /// # Examples - /// # Panics - pub fn bar_2() {} -} diff --git a/tests/rustdoc/issue-29503.rs b/tests/rustdoc/issue-29503.rs deleted file mode 100644 index 01ae44385..000000000 --- a/tests/rustdoc/issue-29503.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::fmt; - -// @has issue_29503/trait.MyTrait.html -pub trait MyTrait { - fn my_string(&self) -> String; -} - -// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header']" "impl<T> MyTrait for Twhere T: Debug" -impl<T> MyTrait for T -where - T: fmt::Debug, -{ - fn my_string(&self) -> String { - format!("{:?}", self) - } -} - -pub fn main() {} diff --git a/tests/rustdoc/issue-29584.rs b/tests/rustdoc/issue-29584.rs deleted file mode 100644 index 4364a9649..000000000 --- a/tests/rustdoc/issue-29584.rs +++ /dev/null @@ -1,8 +0,0 @@ -// aux-build:issue-29584.rs -// ignore-cross-compile - -extern crate issue_29584; - -// @has issue_29584/struct.Foo.html -// @!hasraw - 'impl Bar for' -pub use issue_29584::Foo; diff --git a/tests/rustdoc/issue-30109.rs b/tests/rustdoc/issue-30109.rs deleted file mode 100644 index e9447538a..000000000 --- a/tests/rustdoc/issue-30109.rs +++ /dev/null @@ -1,14 +0,0 @@ -// build-aux-docs -// aux-build:issue-30109-1.rs -// ignore-cross-compile - -pub mod quux { - extern crate issue_30109_1 as bar; - use self::bar::Bar; - - pub trait Foo {} - - // @has issue_30109/quux/trait.Foo.html \ - // '//a/@href' '../issue_30109_1/struct.Bar.html' - impl Foo for Bar {} -} diff --git a/tests/rustdoc/issue-30252.rs b/tests/rustdoc/issue-30252.rs deleted file mode 100644 index c3777362a..000000000 --- a/tests/rustdoc/issue-30252.rs +++ /dev/null @@ -1,6 +0,0 @@ -// compile-flags:--test --cfg feature="bar" - -/// ```rust -/// assert_eq!(cfg!(feature = "bar"), true); -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc/issue-30366.rs b/tests/rustdoc/issue-30366.rs deleted file mode 100644 index c6274a058..000000000 --- a/tests/rustdoc/issue-30366.rs +++ /dev/null @@ -1,6 +0,0 @@ -// @has issue_30366/index.html '//a/@href' 'http://www.rust-lang.org/' - -/// Describe it. [Link somewhere][1]. -/// -/// [1]: http://www.rust-lang.org/ -pub fn here_is_a_fn() { } diff --git a/tests/rustdoc/issue-31808.rs b/tests/rustdoc/issue-31808.rs deleted file mode 100644 index e55c5bd4f..000000000 --- a/tests/rustdoc/issue-31808.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Test that associated item impls on primitive types don't crash rustdoc - -pub trait Foo { - const BAR: usize; - type BAZ; -} - -impl Foo for () { - const BAR: usize = 0; - type BAZ = usize; -} diff --git a/tests/rustdoc/issue-31899.rs b/tests/rustdoc/issue-31899.rs deleted file mode 100644 index 3eee37446..000000000 --- a/tests/rustdoc/issue-31899.rs +++ /dev/null @@ -1,59 +0,0 @@ -// @has issue_31899/index.html -// @hasraw - 'Make this line a bit longer.' -// @!hasraw - 'rust rust-example-rendered' -// @!hasraw - 'use ndarray::arr2' -// @!hasraw - 'prohibited' - -/// A tuple or fixed size array that can be used to index an array. -/// Make this line a bit longer. -/// -/// ``` -/// use ndarray::arr2; -/// -/// let mut a = arr2(&[[0, 1], [0, 0]]); -/// a[[1, 1]] = 1; -/// assert_eq!(a[[0, 1]], 1); -/// assert_eq!(a[[1, 1]], 1); -/// ``` -/// -/// **Note** the blanket implementation that's not visible in rustdoc: -/// `impl<D> NdIndex for D where D: Dimension { ... }` -pub fn bar() {} - -/// Some line -/// -/// # prohibited -pub fn foo() {} - -/// Some line -/// -/// 1. prohibited -/// 2. bar -pub fn baz() {} - -/// Some line -/// -/// - prohibited -/// - bar -pub fn qux() {} - -/// Some line -/// -/// * prohibited -/// * bar -pub fn quz() {} - -/// Some line -/// -/// > prohibited -/// > bar -pub fn qur() {} - -/// Some line -/// -/// prohibited -/// ===== -/// -/// Second -/// ------ -pub fn qut() {} diff --git a/tests/rustdoc/issue-32077-type-alias-impls.rs b/tests/rustdoc/issue-32077-type-alias-impls.rs deleted file mode 100644 index ac486c36a..000000000 --- a/tests/rustdoc/issue-32077-type-alias-impls.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Regression test for <https://github.com/rust-lang/rust/issues/32077>. - -#![crate_name = "foo"] - -pub struct GenericStruct<T>(T); - -impl<T> GenericStruct<T> { - pub fn on_gen(arg: T) {} -} - -impl GenericStruct<u32> { - pub fn on_u32(arg: u32) {} -} - -pub trait Foo {} -pub trait Bar {} - -impl<T> Foo for GenericStruct<T> {} -impl Bar for GenericStruct<u32> {} - -// @has 'foo/type.TypedefStruct.html' -// We check that "Aliased type" is also present as a title in the sidebar. -// @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type' -// We check that we have the implementation of the type alias itself. -// @has - '//*[@id="impl-TypedefStruct"]/h3' 'impl TypedefStruct' -// @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()' -// @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl<T> GenericStruct<T>' -// @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)' -// @has - '//*[@id="impl-Foo-for-GenericStruct%3CT%3E"]/h3' 'impl<T> Foo for GenericStruct<T>' -// This trait implementation doesn't match the type alias parameters so shouldn't appear in docs. -// @!has - '//h3' 'impl Bar for GenericStruct<u32> {}' -// Same goes for the `Deref` impl. -// @!has - '//h2' 'Methods from Deref<Target = u32>' -// @count - '//nav[@class="sidebar"]//a' 'on_alias' 1 -// @count - '//nav[@class="sidebar"]//a' 'on_gen' 1 -// @count - '//nav[@class="sidebar"]//a' 'Foo' 1 -// @!has - '//nav[@class="sidebar"]//a' 'Bar' -// @!has - '//nav[@class="sidebar"]//a' 'on_u32' -pub type TypedefStruct = GenericStruct<u8>; - -impl TypedefStruct { - pub fn on_alias() {} -} - -impl std::ops::Deref for GenericStruct<u32> { - type Target = u32; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -pub struct Wrap<T>(GenericStruct<T>); - -// @has 'foo/type.Alias.html' -// @has - '//h2' 'Methods from Deref<Target = u32>' -// @has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl<T> Deref for Wrap<T>' -pub type Alias = Wrap<u32>; - -impl<T> std::ops::Deref for Wrap<T> { - type Target = GenericStruct<T>; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} diff --git a/tests/rustdoc/issue-32374.rs b/tests/rustdoc/issue-32374.rs deleted file mode 100644 index 985bf03a1..000000000 --- a/tests/rustdoc/issue-32374.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![feature(staged_api)] -#![doc(issue_tracker_base_url = "https://issue_url/")] -#![unstable(feature = "test", issue = "32374")] - -// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \ -// 'Deprecated' -// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab unstable"]' \ -// 'Experimental' -// @matches issue_32374/index.html '//*[@class="desc docblock-short"]/text()' 'Docs' - -// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '👎' -// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \ -// 'Deprecated since 1.0.0: text' -// @hasraw - '<code>test</code> <a href="https://issue_url/32374">#32374</a>' -// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' '🔬' -// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ -// 'This is a nightly-only experimental API. \(test\s#32374\)$' -/// Docs -#[deprecated(since = "1.0.0", note = "text")] -#[unstable(feature = "test", issue = "32374")] -pub struct T; - -// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' '👎' -// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \ -// 'Deprecated since 1.0.0: deprecated' -// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' '🔬' -// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \ -// 'This is a nightly-only experimental API. (test #32374)' -#[deprecated(since = "1.0.0", note = "deprecated")] -#[unstable(feature = "test", issue = "32374", reason = "unstable")] -pub struct U; diff --git a/tests/rustdoc/issue-32395.rs b/tests/rustdoc/issue-32395.rs deleted file mode 100644 index 5552300f9..000000000 --- a/tests/rustdoc/issue-32395.rs +++ /dev/null @@ -1,15 +0,0 @@ -// aux-build:variant-struct.rs -// build-aux-docs -// ignore-cross-compile - -// @has variant_struct/enum.Foo.html -// @!hasraw - 'pub qux' -// @!hasraw - 'pub(crate) qux' -// @!hasraw - 'pub Bar' -extern crate variant_struct; - -// @has issue_32395/enum.Foo.html -// @!hasraw - 'pub qux' -// @!hasraw - 'pub(crate) qux' -// @!hasraw - 'pub Bar' -pub use variant_struct::Foo; diff --git a/tests/rustdoc/issue-32556.rs b/tests/rustdoc/issue-32556.rs deleted file mode 100644 index e1cf11509..000000000 --- a/tests/rustdoc/issue-32556.rs +++ /dev/null @@ -1,5 +0,0 @@ -/// Blah blah blah -/// ```ignore (testing rustdoc's handling of ignore) -/// bad_assert!(); -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc/issue-32890.rs b/tests/rustdoc/issue-32890.rs deleted file mode 100644 index 970954433..000000000 --- a/tests/rustdoc/issue-32890.rs +++ /dev/null @@ -1,17 +0,0 @@ -// @has issue_32890/struct.Foo.html -pub struct Foo<T>(T); - -impl Foo<u8> { - // @has - '//a[@href="#method.pass"]' 'pass' - pub fn pass() {} -} - -impl Foo<u16> { - // @has - '//a[@href="#method.pass-1"]' 'pass' - pub fn pass() {} -} - -impl Foo<u32> { - // @has - '//a[@href="#method.pass-2"]' 'pass' - pub fn pass() {} -} diff --git a/tests/rustdoc/issue-33069.rs b/tests/rustdoc/issue-33069.rs deleted file mode 100644 index 0213a53ca..000000000 --- a/tests/rustdoc/issue-33069.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub trait Bar {} - -#[doc(hidden)] -pub mod hidden { - pub struct Foo; -} - -// @has issue_33069/trait.Bar.html -// @!has - '//code' 'impl Bar for Foo' -impl Bar for hidden::Foo {} diff --git a/tests/rustdoc/issue-33178-1.rs b/tests/rustdoc/issue-33178-1.rs deleted file mode 100644 index 4dc425346..000000000 --- a/tests/rustdoc/issue-33178-1.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:empty.rs -// aux-build:variant-struct.rs -// ignore-cross-compile - -// @has issue_33178_1/index.html -// @!has - //a/@title empty -pub extern crate empty; - -// @!has - //a/@title variant_struct -pub extern crate variant_struct as foo; diff --git a/tests/rustdoc/issue-33178.rs b/tests/rustdoc/issue-33178.rs deleted file mode 100644 index ed643f5ae..000000000 --- a/tests/rustdoc/issue-33178.rs +++ /dev/null @@ -1,14 +0,0 @@ -// aux-build:empty.rs -// aux-build:variant-struct.rs -// build-aux-docs -// ignore-cross-compile - -// @has issue_33178/index.html -// @has - '//a[@title="mod empty"][@href="../empty/index.html"]' empty -pub extern crate empty; - -// @has - '//a[@title="mod variant_struct"][@href="../variant_struct/index.html"]' variant_struct -pub extern crate variant_struct as foo; - -// @has - '//a[@title="mod issue_33178"][@href="index.html"]' self -pub extern crate self as bar; diff --git a/tests/rustdoc/issue-33302.rs b/tests/rustdoc/issue-33302.rs deleted file mode 100644 index a316f3ad9..000000000 --- a/tests/rustdoc/issue-33302.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Ensure constant and array length values are not taken from source -// code, which wreaks havoc with macros. - -macro_rules! make { - ($n:expr) => { - pub struct S; - - // @has issue_33302/constant.CST.html \ - // '//pre[@class="rust item-decl"]' 'pub const CST: i32' - pub const CST: i32 = ($n * $n); - // @has issue_33302/static.ST.html \ - // '//pre[@class="rust item-decl"]' 'pub static ST: i32' - pub static ST: i32 = ($n * $n); - - pub trait T<X> { - fn ignore(_: &X) {} - const C: X; - // @has issue_33302/trait.T.html \ - // '//pre[@class="rust item-decl"]' 'const D: i32' - // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' - const D: i32 = ($n * $n); - } - - // @has issue_33302/struct.S.html \ - // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' - // @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]' - // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' - impl T<[i32; ($n * $n)]> for S { - const C: [i32; ($n * $n)] = [0; ($n * $n)]; - } - - // @has issue_33302/struct.S.html \ - // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' - // @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)' - // @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32' - impl T<(i32,)> for S { - const C: (i32,) = ($n,); - } - - // @has issue_33302/struct.S.html \ - // '//*[@class="impl"]' 'impl T<(i32, i32)> for S' - // @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)' - // @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32' - impl T<(i32, i32)> for S { - const C: (i32, i32) = ($n, $n); - const D: i32 = ($n / $n); - } - }; -} - -make!(4); diff --git a/tests/rustdoc/issue-33592.rs b/tests/rustdoc/issue-33592.rs deleted file mode 100644 index 7a128f0b8..000000000 --- a/tests/rustdoc/issue-33592.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_name = "foo"] - -pub trait Foo<T> {} - -pub struct Bar; - -pub struct Baz; - -// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl Foo<i32> for Bar' -impl Foo<i32> for Bar {} - -// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl<T> Foo<T> for Baz' -impl<T> Foo<T> for Baz {} diff --git a/tests/rustdoc/issue-34025.rs b/tests/rustdoc/issue-34025.rs deleted file mode 100644 index 9b9f21cb3..000000000 --- a/tests/rustdoc/issue-34025.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_name = "foo"] - -// @!has 'foo/sys/index.html' -// @!has 'foo/sys/sidebar-items.js' -#[doc(hidden)] -pub mod sys { - extern "C" { - // @!has 'foo/sys/fn.foo.html' - #[doc(hidden)] - pub fn foo(); - } -} diff --git a/tests/rustdoc/issue-34274.rs b/tests/rustdoc/issue-34274.rs deleted file mode 100644 index ce5be84a5..000000000 --- a/tests/rustdoc/issue-34274.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:issue-34274.rs -// build-aux-docs -// ignore-cross-compile - -#![crate_name = "foo"] - -extern crate issue_34274; - -// @has foo/fn.extern_c_fn.html '//a/@href' '../src/issue_34274/issue-34274.rs.html#2' -pub use issue_34274::extern_c_fn; diff --git a/tests/rustdoc/issue-43701.rs b/tests/rustdoc/issue-43701.rs index 44335e961..de772881e 100644 --- a/tests/rustdoc/issue-43701.rs +++ b/tests/rustdoc/issue-43701.rs @@ -2,4 +2,4 @@ pub use std::vec::Vec; -// @!has implementors/core/clone/trait.Clone.js +// @!has trait.impl/core/clone/trait.Clone.js diff --git a/tests/rustdoc/issue-78701.rs b/tests/rustdoc/issue-78701.rs index e3e46468f..3f1638d5f 100644 --- a/tests/rustdoc/issue-78701.rs +++ b/tests/rustdoc/issue-78701.rs @@ -6,7 +6,7 @@ // @has 'foo/struct.AnotherStruct.html' // @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3C()%3E"]' 1 -// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3CT%3E"]' 1 +// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-T"]' 1 pub trait Something {} diff --git a/tests/rustdoc/link-extern-crate-33178.rs b/tests/rustdoc/link-extern-crate-33178.rs new file mode 100644 index 000000000..6a63712c4 --- /dev/null +++ b/tests/rustdoc/link-extern-crate-33178.rs @@ -0,0 +1,17 @@ +// aux-build:empty.rs +// aux-build:variant-struct.rs +// build-aux-docs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/33178 +#![crate_name="issue_33178"] + +// @has issue_33178/index.html +// @has - '//a[@title="mod empty"][@href="../empty/index.html"]' empty +pub extern crate empty; + +// @has - '//a[@title="mod variant_struct"][@href="../variant_struct/index.html"]' variant_struct +pub extern crate variant_struct as foo; + +// @has - '//a[@title="mod issue_33178"][@href="index.html"]' self +pub extern crate self as bar; diff --git a/tests/rustdoc/link-extern-crate-item-30109.rs b/tests/rustdoc/link-extern-crate-item-30109.rs new file mode 100644 index 000000000..c83234352 --- /dev/null +++ b/tests/rustdoc/link-extern-crate-item-30109.rs @@ -0,0 +1,17 @@ +// build-aux-docs +// aux-build:issue-30109-1.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/30109 +#![crate_name="issue_30109"] + +pub mod quux { + extern crate issue_30109_1 as bar; + use self::bar::Bar; + + pub trait Foo {} + + // @has issue_30109/quux/trait.Foo.html \ + // '//a/@href' '../issue_30109_1/struct.Bar.html' + impl Foo for Bar {} +} diff --git a/tests/rustdoc/link-extern-crate-title-33178.rs b/tests/rustdoc/link-extern-crate-title-33178.rs new file mode 100644 index 000000000..d2f115a38 --- /dev/null +++ b/tests/rustdoc/link-extern-crate-title-33178.rs @@ -0,0 +1,13 @@ +// aux-build:empty.rs +// aux-build:variant-struct.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/33178 +#![crate_name="issue_33178_1"] + +// @has issue_33178_1/index.html +// @!has - //a/@title empty +pub extern crate empty; + +// @!has - //a/@title variant_struct +pub extern crate variant_struct as foo; diff --git a/tests/rustdoc/logo-class-default.rs b/tests/rustdoc/logo-class-default.rs index d2d439199..6b46b4605 100644 --- a/tests/rustdoc/logo-class-default.rs +++ b/tests/rustdoc/logo-class-default.rs @@ -1,4 +1,4 @@ -// Note: this test is paired with logo-class.rs. -// @has logo_class_default/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' -// @has src/logo_class_default/logo-class-default.rs.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' +// Note: this test is paired with logo-class.rs and logo-class-rust.rs. +// @!has logo_class_default/struct.SomeStruct.html '//*[@class="logo-container"]/img' '' +// @!has src/logo_class_default/logo-class-default.rs.html '//*[@class="sub-logo-container"]/img' '' pub struct SomeStruct; diff --git a/tests/rustdoc/logo-class-rust.rs b/tests/rustdoc/logo-class-rust.rs new file mode 100644 index 000000000..d4f6113c0 --- /dev/null +++ b/tests/rustdoc/logo-class-rust.rs @@ -0,0 +1,7 @@ +#![feature(rustdoc_internals)] +#![allow(internal_features)] +#![doc(rust_logo)] +// Note: this test is paired with logo-class.rs and logo-class-default.rs. +// @has logo_class_rust/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' +// @has src/logo_class_rust/logo-class-rust.rs.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' +pub struct SomeStruct; diff --git a/tests/rustdoc/logo-class.rs b/tests/rustdoc/logo-class.rs index d3aa446da..d15ce134c 100644 --- a/tests/rustdoc/logo-class.rs +++ b/tests/rustdoc/logo-class.rs @@ -1,6 +1,6 @@ #![doc(html_logo_url = "https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png")] -// Note: this test is paired with logo-class-default.rs. +// Note: this test is paired with logo-class-default.rs and logo-class-rust.rs. // @has logo_class/struct.SomeStruct.html '//*[@class="logo-container"]/img[@src="https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png"]' '' // @!has logo_class/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' diff --git a/tests/rustdoc/macro-doc-comment-23812.rs b/tests/rustdoc/macro-doc-comment-23812.rs new file mode 100644 index 000000000..57c18510b --- /dev/null +++ b/tests/rustdoc/macro-doc-comment-23812.rs @@ -0,0 +1,39 @@ +// https://github.com/rust-lang/rust/issues/23812 +#![crate_name="issue_23812"] + +macro_rules! doc { + (#[$outer:meta] mod $i:ident { #![$inner:meta] }) => + ( + #[$outer] + pub mod $i { + #![$inner] + } + ) +} + +doc! { + /// Outer comment + mod Foo { + //! Inner comment + } +} + +// @has issue_23812/Foo/index.html +// @hasraw - 'Outer comment' +// @!hasraw - '/// Outer comment' +// @hasraw - 'Inner comment' +// @!hasraw - '//! Inner comment' + + +doc! { + /** Outer block comment */ + mod Bar { + /*! Inner block comment */ + } +} + +// @has issue_23812/Bar/index.html +// @hasraw - 'Outer block comment' +// @!hasraw - '/** Outer block comment */' +// @hasraw - 'Inner block comment' +// @!hasraw - '/*! Inner block comment */' diff --git a/tests/rustdoc/markdown-table-escape-pipe-27862.rs b/tests/rustdoc/markdown-table-escape-pipe-27862.rs new file mode 100644 index 000000000..9af75d248 --- /dev/null +++ b/tests/rustdoc/markdown-table-escape-pipe-27862.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/27862 +#![crate_name="issue_27862"] + +/// Tests | Table +/// ------|------------- +/// t = b | id = \|x\| x +pub struct Foo; // @has issue_27862/struct.Foo.html //td 'id = |x| x' diff --git a/tests/rustdoc/normalize-assoc-item.rs b/tests/rustdoc/normalize-assoc-item.rs index c6fd5e110..d39e1b15a 100644 --- a/tests/rustdoc/normalize-assoc-item.rs +++ b/tests/rustdoc/normalize-assoc-item.rs @@ -30,7 +30,7 @@ pub fn f2() -> <isize as Trait>::X { } pub struct S { - // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.box_me_up"]' 'box_me_up: Box<S, Global>' + // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.box_me_up"]' 'box_me_up: Box<S>' pub box_me_up: <S as Trait>::X, // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.generic"]' 'generic: (usize, isize)' pub generic: <Generic<usize> as Trait>::X, @@ -76,7 +76,7 @@ extern crate inner; // @has 'normalize_assoc_item/fn.foo.html' '//pre[@class="rust item-decl"]' "pub fn foo() -> i32" pub use inner::foo; -// @has 'normalize_assoc_item/fn.h.html' '//pre[@class="rust item-decl"]' "pub fn h<T>() -> IntoIter<T, Global>" +// @has 'normalize_assoc_item/fn.h.html' '//pre[@class="rust item-decl"]' "pub fn h<T>() -> IntoIter<T>" pub fn h<T>() -> <Vec<T> as IntoIterator>::IntoIter { vec![].into_iter() } diff --git a/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs b/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs index 3fb00c7db..6b94d7994 100644 --- a/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs +++ b/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs @@ -3,25 +3,28 @@ #![feature(no_core)] #![no_core] #[lang = "owned_box"] -pub struct Box<T>; +pub struct Box<T>(*const T); impl<T> Box<T> { pub fn new(x: T) -> Box<T> { - Box + Box(std::ptr::null()) } } +#[lang = "sized"] +trait Sized {} + #[doc(notable_trait)] pub trait FakeIterator {} impl<I: FakeIterator> FakeIterator for Box<I> {} #[lang = "pin"] -pub struct Pin<T>; +pub struct Pin<T>(T); impl<T> Pin<T> { pub fn new(x: T) -> Pin<T> { - Pin + Pin(x) } } diff --git a/tests/rustdoc/primitive/primitive-generic-impl.rs b/tests/rustdoc/primitive/primitive-generic-impl.rs index 2da8ae6ff..558336d73 100644 --- a/tests/rustdoc/primitive/primitive-generic-impl.rs +++ b/tests/rustdoc/primitive/primitive-generic-impl.rs @@ -1,7 +1,7 @@ #![feature(rustc_attrs)] #![crate_name = "foo"] -// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-i32"]//h3[@class="code-header"]' 'impl<T> ToString for T' +// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-T"]//h3[@class="code-header"]' 'impl<T> ToString for T' #[rustc_doc_primitive = "i32"] /// Some useless docs, wouhou! diff --git a/tests/rustdoc/render-enum-variant-structlike-32395.rs b/tests/rustdoc/render-enum-variant-structlike-32395.rs new file mode 100644 index 000000000..2200d8ec6 --- /dev/null +++ b/tests/rustdoc/render-enum-variant-structlike-32395.rs @@ -0,0 +1,18 @@ +// aux-build:variant-struct.rs +// build-aux-docs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/32395 +#![crate_name="issue_32395"] + +// @has variant_struct/enum.Foo.html +// @!hasraw - 'pub qux' +// @!hasraw - 'pub(crate) qux' +// @!hasraw - 'pub Bar' +extern crate variant_struct; + +// @has issue_32395/enum.Foo.html +// @!hasraw - 'pub qux' +// @!hasraw - 'pub(crate) qux' +// @!hasraw - 'pub Bar' +pub use variant_struct::Foo; diff --git a/tests/rustdoc/repr.rs b/tests/rustdoc/repr.rs new file mode 100644 index 000000000..fbb46e126 --- /dev/null +++ b/tests/rustdoc/repr.rs @@ -0,0 +1,29 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/90435>. +// Check that we show `#[repr(transparent)]` iff the non-1-ZST field is public or at least one +// field is public in case all fields are 1-ZST fields. + +// @has 'repr/struct.ReprTransparentPrivField.html' +// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +#[repr(transparent)] // private +pub struct ReprTransparentPrivField { + field: u32, // non-1-ZST field +} + +// @has 'repr/struct.ReprTransparentPriv1ZstFields.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +#[repr(transparent)] // public +pub struct ReprTransparentPriv1ZstFields { + marker0: Marker, + pub main: u64, // non-1-ZST field + marker1: Marker, +} + +// @has 'repr/struct.ReprTransparentPub1ZstField.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +#[repr(transparent)] // public +pub struct ReprTransparentPub1ZstField { + marker0: Marker, + pub marker1: Marker, +} + +struct Marker; // 1-ZST diff --git a/tests/rustdoc/search-index-primitive-inherent-method-23511.rs b/tests/rustdoc/search-index-primitive-inherent-method-23511.rs new file mode 100644 index 000000000..1d0fe27e1 --- /dev/null +++ b/tests/rustdoc/search-index-primitive-inherent-method-23511.rs @@ -0,0 +1,16 @@ +#![feature(rustc_attrs)] +#![feature(rustdoc_internals)] +#![no_std] + +// https://github.com/rust-lang/rust/issues/23511 +#![crate_name="issue_23511"] + +pub mod str { + #![rustc_doc_primitive = "str"] + + impl str { + // @hasraw search-index.js foo + #[rustc_allow_incoherent_impl] + pub fn foo(&self) {} + } +} diff --git a/tests/rustdoc/sidebar-items.rs b/tests/rustdoc/sidebar-items.rs index 6f7afa59b..b746f6982 100644 --- a/tests/rustdoc/sidebar-items.rs +++ b/tests/rustdoc/sidebar-items.rs @@ -14,6 +14,7 @@ // @has - '//*[@class="sidebar-elems"]//section//a' 'Output' // @has - '//div[@class="sidebar-elems"]//h3/a[@href="#provided-associated-types"]' 'Provided Associated Types' // @has - '//*[@class="sidebar-elems"]//section//a' 'Extra' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#object-safety"]' 'Object Safety' pub trait Foo { const FOO: usize; const BAR: u32 = 0; @@ -24,6 +25,12 @@ pub trait Foo { fn bar() -> Self::Output; } +// @has foo/trait.Safe.html +// @!has - '//div[@class="sidebar-elems"]//h3/a[@href="#object-safety"]' '' +pub trait Safe { + fn access(&self); +} + // @has foo/struct.Bar.html // @has - '//div[@class="sidebar-elems"]//h3/a[@href="#fields"]' 'Fields' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#structfield.f"]' 'f' diff --git a/tests/rustdoc/sidebar-links-to-foreign-impl.rs b/tests/rustdoc/sidebar-links-to-foreign-impl.rs index caa17dfbb..733a18ad9 100644 --- a/tests/rustdoc/sidebar-links-to-foreign-impl.rs +++ b/tests/rustdoc/sidebar-links-to-foreign-impl.rs @@ -7,8 +7,8 @@ // @has - '//h2[@id="foreign-impls"]' 'Implementations on Foreign Types' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#impl-Foo-for-u32"]' 'u32' // @has - '//*[@id="impl-Foo-for-u32"]//h3[@class="code-header"]' 'impl Foo for u32' -// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26'a+str\"]" "&'a str" -// @has - "//*[@id=\"impl-Foo-for-%26'a+str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str" +// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26str\"]" "&'a str" +// @has - "//*[@id=\"impl-Foo-for-%26str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str" pub trait Foo {} impl Foo for u32 {} diff --git a/tests/rustdoc/source-version-separator.rs b/tests/rustdoc/source-version-separator.rs index 14580373b..7256f7315 100644 --- a/tests/rustdoc/source-version-separator.rs +++ b/tests/rustdoc/source-version-separator.rs @@ -3,23 +3,23 @@ #![feature(staged_api)] // @has foo/trait.Bar.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub trait Bar { - // @has - '//*[@id="tymethod.foo"]/*[@class="rightside"]' '3.0 · source' + // @has - '//*[@id="tymethod.foo"]/*[@class="rightside"]' '3.0.0 · source' #[stable(feature = "foobar", since = "3.0")] fn foo(); } -// @has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0 · source' +// @has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0.0 · source' // @has foo/struct.Foo.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "baz", since = "1.0")] pub struct Foo; impl Foo { - // @has - '//*[@id="method.foofoo"]/*[@class="rightside"]' '3.0 · source' + // @has - '//*[@id="method.foofoo"]/*[@class="rightside"]' '3.0.0 · source' #[stable(feature = "foobar", since = "3.0")] pub fn foofoo() {} } diff --git a/tests/rustdoc/src-link-external-macro-26606.rs b/tests/rustdoc/src-link-external-macro-26606.rs new file mode 100644 index 000000000..de717a527 --- /dev/null +++ b/tests/rustdoc/src-link-external-macro-26606.rs @@ -0,0 +1,14 @@ +// aux-build:issue-26606-macro.rs +// ignore-cross-compile +// build-aux-docs + +// https://github.com/rust-lang/rust/issues/26606 +#![crate_name="issue_26606"] + +// @has issue_26606_macro/macro.make_item.html +#[macro_use] +extern crate issue_26606_macro; + +// @has issue_26606/constant.FOO.html +// @has - '//a[@href="../src/issue_26606/src-link-external-macro-26606.rs.html#14"]' 'source' +make_item!(FOO); diff --git a/tests/rustdoc/src-links-auto-impls.rs b/tests/rustdoc/src-links-auto-impls.rs index 1c8d15731..08a497d4c 100644 --- a/tests/rustdoc/src-links-auto-impls.rs +++ b/tests/rustdoc/src-links-auto-impls.rs @@ -5,8 +5,8 @@ // @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="src"]' 'source' // @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header"]' 'impl Sync for Unsized' // @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="src"]' 'source' -// @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header"]' 'impl<T> Any for T' -// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="src rightside"]' 'source' +// @has - '//*[@id="impl-Any-for-T"]/h3[@class="code-header"]' 'impl<T> Any for T' +// @has - '//*[@id="impl-Any-for-T"]//a[@class="src rightside"]' 'source' pub struct Unsized { data: [u8], } diff --git a/tests/rustdoc/src-links-inlined-34274.rs b/tests/rustdoc/src-links-inlined-34274.rs new file mode 100644 index 000000000..a3c9bf7e4 --- /dev/null +++ b/tests/rustdoc/src-links-inlined-34274.rs @@ -0,0 +1,11 @@ +// aux-build:issue-34274.rs +// build-aux-docs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/34274 +#![crate_name = "foo"] + +extern crate issue_34274; + +// @has foo/fn.extern_c_fn.html '//a/@href' '../src/issue_34274/issue-34274.rs.html#2' +pub use issue_34274::extern_c_fn; diff --git a/tests/rustdoc/src-mod-path-absolute-26995.rs b/tests/rustdoc/src-mod-path-absolute-26995.rs new file mode 100644 index 000000000..b67fd9b26 --- /dev/null +++ b/tests/rustdoc/src-mod-path-absolute-26995.rs @@ -0,0 +1,10 @@ +// ignore-windows +// compile-flags: --no-defaults + +// https://github.com/rust-lang/rust/issues/26995 +#![crate_name="issue_26995"] + +// @has src/issue_26995/dev/null.html +// @has issue_26995/null/index.html '//a/@href' '../../src/issue_26995/dev/null.html' +#[path="/dev/null"] +pub mod null; diff --git a/tests/rustdoc/staged-api-deprecated-unstable-32374.rs b/tests/rustdoc/staged-api-deprecated-unstable-32374.rs new file mode 100644 index 000000000..d282dea90 --- /dev/null +++ b/tests/rustdoc/staged-api-deprecated-unstable-32374.rs @@ -0,0 +1,33 @@ +// https://github.com/rust-lang/rust/issues/32374 +#![feature(staged_api)] +#![doc(issue_tracker_base_url = "https://issue_url/")] +#![unstable(feature = "test", issue = "32374")] +#![crate_name="issue_32374"] + +// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \ +// 'Deprecated' +// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab unstable"]' \ +// 'Experimental' +// @matches issue_32374/index.html '//*[@class="desc docblock-short"]/text()' 'Docs' + +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '👎' +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \ +// 'Deprecated since 1.0.0: text' +// @hasraw - '<code>test</code> <a href="https://issue_url/32374">#32374</a>' +// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' '🔬' +// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ +// 'This is a nightly-only experimental API. \(test\s#32374\)$' +/// Docs +#[deprecated(since = "1.0.0", note = "text")] +#[unstable(feature = "test", issue = "32374")] +pub struct T; + +// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' '👎' +// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \ +// 'Deprecated since 1.0.0: deprecated' +// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' '🔬' +// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \ +// 'This is a nightly-only experimental API. (test #32374)' +#[deprecated(since = "1.0.0", note = "deprecated")] +#[unstable(feature = "test", issue = "32374", reason = "unstable")] +pub struct U; diff --git a/tests/rustdoc/staged-api-feature-issue-27759.rs b/tests/rustdoc/staged-api-feature-issue-27759.rs new file mode 100644 index 000000000..56a45a600 --- /dev/null +++ b/tests/rustdoc/staged-api-feature-issue-27759.rs @@ -0,0 +1,17 @@ +// https://github.com/rust-lang/rust/issues/27759 +#![crate_name="issue_27759"] + +#![feature(staged_api)] +#![doc(issue_tracker_base_url = "http://issue_url/")] + +#![unstable(feature="test", issue="27759")] + +// @has issue_27759/unstable/index.html +// @hasraw - '<code>test</code> <a href="http://issue_url/27759">#27759</a>' +#[unstable(feature="test", issue="27759")] +pub mod unstable { + // @has issue_27759/unstable/fn.issue.html + // @hasraw - '<code>test_function</code> <a href="http://issue_url/12345">#12345</a>' + #[unstable(feature="test_function", issue="12345")] + pub fn issue() {} +} diff --git a/tests/rustdoc/strip-enum-variant.no-not-shown.html b/tests/rustdoc/strip-enum-variant.no-not-shown.html index 782198956..e07233529 100644 --- a/tests/rustdoc/strip-enum-variant.no-not-shown.html +++ b/tests/rustdoc/strip-enum-variant.no-not-shown.html @@ -1 +1 @@ -<ul class="block"><li><a href="#variant.Shown">Shown</a></li></ul>
\ No newline at end of file +<ul class="block variant"><li><a href="#variant.Shown">Shown</a></li></ul>
\ No newline at end of file diff --git a/tests/rustdoc/strip-enum-variant.rs b/tests/rustdoc/strip-enum-variant.rs index 8753a7dc6..2512fa34b 100644 --- a/tests/rustdoc/strip-enum-variant.rs +++ b/tests/rustdoc/strip-enum-variant.rs @@ -3,7 +3,7 @@ // @!has - '//code' 'NotShown' // @has - '//code' '// some variants omitted' // Also check that `NotShown` isn't displayed in the sidebar. -// @snapshot no-not-shown - '//*[@class="sidebar-elems"]/section/*[@class="block"][1]' +// @snapshot no-not-shown - '//*[@class="sidebar-elems"]/section/*[@class="block variant"]' pub enum MyThing { Shown, #[doc(hidden)] diff --git a/tests/rustdoc/strip-priv-imports-pass-27104.rs b/tests/rustdoc/strip-priv-imports-pass-27104.rs new file mode 100644 index 000000000..e400a8f50 --- /dev/null +++ b/tests/rustdoc/strip-priv-imports-pass-27104.rs @@ -0,0 +1,13 @@ +// compile-flags:--no-defaults --passes strip-priv-imports +// aux-build:empty.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/27104 +#![crate_name="issue_27104"] + +// @has issue_27104/index.html +// @!hasraw - 'extern crate std' +// @!hasraw - 'use std::prelude::' + +// @hasraw - 'pub extern crate empty' +pub extern crate empty; diff --git a/tests/rustdoc/summary-codeblock-31899.rs b/tests/rustdoc/summary-codeblock-31899.rs new file mode 100644 index 000000000..c1b33058c --- /dev/null +++ b/tests/rustdoc/summary-codeblock-31899.rs @@ -0,0 +1,62 @@ +// https://github.com/rust-lang/rust/issues/31899 +#![crate_name="issue_31899"] + +// @has issue_31899/index.html +// @hasraw - 'Make this line a bit longer.' +// @!hasraw - 'rust rust-example-rendered' +// @!hasraw - 'use ndarray::arr2' +// @!hasraw - 'prohibited' + +/// A tuple or fixed size array that can be used to index an array. +/// Make this line a bit longer. +/// +/// ``` +/// use ndarray::arr2; +/// +/// let mut a = arr2(&[[0, 1], [0, 0]]); +/// a[[1, 1]] = 1; +/// assert_eq!(a[[0, 1]], 1); +/// assert_eq!(a[[1, 1]], 1); +/// ``` +/// +/// **Note** the blanket implementation that's not visible in rustdoc: +/// `impl<D> NdIndex for D where D: Dimension { ... }` +pub fn bar() {} + +/// Some line +/// +/// # prohibited +pub fn foo() {} + +/// Some line +/// +/// 1. prohibited +/// 2. bar +pub fn baz() {} + +/// Some line +/// +/// - prohibited +/// - bar +pub fn qux() {} + +/// Some line +/// +/// * prohibited +/// * bar +pub fn quz() {} + +/// Some line +/// +/// > prohibited +/// > bar +pub fn qur() {} + +/// Some line +/// +/// prohibited +/// ===== +/// +/// Second +/// ------ +pub fn qut() {} diff --git a/tests/rustdoc/summary-reference-link-30366.rs b/tests/rustdoc/summary-reference-link-30366.rs new file mode 100644 index 000000000..5b9854c53 --- /dev/null +++ b/tests/rustdoc/summary-reference-link-30366.rs @@ -0,0 +1,9 @@ +// @has issue_30366/index.html '//a/@href' 'http://www.rust-lang.org/' + +// https://github.com/rust-lang/rust/issues/30366 +#![crate_name="issue_30366"] + +/// Describe it. [Link somewhere][1]. +/// +/// [1]: http://www.rust-lang.org/ +pub fn here_is_a_fn() { } diff --git a/tests/rustdoc/titles.rs b/tests/rustdoc/titles.rs index f6a059de6..f9da5a813 100644 --- a/tests/rustdoc/titles.rs +++ b/tests/rustdoc/titles.rs @@ -2,7 +2,8 @@ #![feature(rustc_attrs)] // @matches 'foo/index.html' '//h1' 'Crate foo' -// @matches 'foo/index.html' '//h2[@class="location"]' 'Crate foo' +// @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' diff --git a/tests/rustdoc/trait-object-safe.rs b/tests/rustdoc/trait-object-safe.rs new file mode 100644 index 000000000..818843f75 --- /dev/null +++ b/tests/rustdoc/trait-object-safe.rs @@ -0,0 +1,27 @@ +#![crate_name = "foo"] + +// @has 'foo/trait.Unsafe.html' +// @has - '//*[@class="object-safety-info"]' 'This trait is not object safe.' +// @has - '//*[@id="object-safety"]' 'Object Safety' +pub trait Unsafe { + fn foo() -> Self; +} + +// @has 'foo/trait.Unsafe2.html' +// @has - '//*[@class="object-safety-info"]' 'This trait is not object safe.' +// @has - '//*[@id="object-safety"]' 'Object Safety' +pub trait Unsafe2<T> { + fn foo(i: T); +} + +// @has 'foo/trait.Safe.html' +// @!has - '//*[@class="object-safety-info"]' '' +// @!has - '//*[@id="object-safety"]' '' +pub trait Safe { + fn foo(&self); +} + +// @has 'foo/struct.Foo.html' +// @!has - '//*[@class="object-safety-info"]' '' +// @!has - '//*[@id="object-safety"]' '' +pub struct Foo; diff --git a/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs b/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs new file mode 100644 index 000000000..3607612c2 --- /dev/null +++ b/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs @@ -0,0 +1,9 @@ +pub struct MyStruct<T>(T); + +pub trait MyTrait1 { + fn method_trait_1(); +} + +impl MyTrait1 for MyStruct<u16> { + fn method_trait_1() {} +} diff --git a/tests/rustdoc/type-alias/cross-crate-115718.rs b/tests/rustdoc/type-alias/cross-crate-115718.rs new file mode 100644 index 000000000..372e62e42 --- /dev/null +++ b/tests/rustdoc/type-alias/cross-crate-115718.rs @@ -0,0 +1,34 @@ +// aux-build: parent-crate-115718.rs + +// https://github.com/rust-lang/rust/issues/115718 +#![crate_name = "foo"] + +extern crate parent_crate_115718; + +use parent_crate_115718::MyStruct; + +pub trait MyTrait2 { + fn method_trait_2(); +} + +impl MyTrait2 for MyStruct<u16> { + fn method_trait_2() {} +} + +pub trait MyTrait3 { + fn method_trait_3(); +} + +impl MyTrait3 for MyType { + fn method_trait_3() {} +} + +// @hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_1' +// @hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_2' +// Avoid duplicating these docs. +// @!hasraw 'foo/type.MyType.html' 'method_trait_1' +// @!hasraw 'foo/type.MyType.html' 'method_trait_2' +// The one made directly on the type alias should be attached to the HTML instead. +// @!hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_3' +// @hasraw 'foo/type.MyType.html' 'method_trait_3' +pub type MyType = MyStruct<u16>; diff --git a/tests/rustdoc/issue-112515-impl-ty-alias.rs b/tests/rustdoc/type-alias/deeply-nested-112515.rs index 161188ee5..161188ee5 100644 --- a/tests/rustdoc/issue-112515-impl-ty-alias.rs +++ b/tests/rustdoc/type-alias/deeply-nested-112515.rs diff --git a/tests/rustdoc/type-alias/deref-32077.rs b/tests/rustdoc/type-alias/deref-32077.rs new file mode 100644 index 000000000..186ebb1a6 --- /dev/null +++ b/tests/rustdoc/type-alias/deref-32077.rs @@ -0,0 +1,70 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/32077>. + +#![crate_name = "foo"] + +pub struct GenericStruct<T>(T); + +impl<T> GenericStruct<T> { + pub fn on_gen(arg: T) {} +} + +impl GenericStruct<u32> { + pub fn on_u32(arg: u32) {} +} + +pub trait Foo {} +pub trait Bar {} + +impl<T> Foo for GenericStruct<T> {} +impl Bar for GenericStruct<u32> {} + +// @has 'foo/type.TypedefStruct.html' +// We check that "Aliased type" is also present as a title in the sidebar. +// @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type' +// We check that we have the implementation of the type alias itself. +// @has - '//*[@id="impl-GenericStruct%3Cu8%3E"]/h3' 'impl TypedefStruct' +// @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()' +// This trait implementation doesn't match the type alias parameters so shouldn't appear in docs. +// @!has - '//h3' 'impl Bar for GenericStruct<u32> {}' +// Same goes for the `Deref` impl. +// @!has - '//h2' 'Methods from Deref<Target = u32>' +// @count - '//nav[@class="sidebar"]//a' 'on_alias' 1 +// @!has - '//nav[@class="sidebar"]//a' 'on_gen' +// @!has - '//nav[@class="sidebar"]//a' 'Foo' +// @!has - '//nav[@class="sidebar"]//a' 'Bar' +// @!has - '//nav[@class="sidebar"]//a' 'on_u32' +// TypedefStruct inlined to GenericStruct +// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'TypedefStruct' +// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'method.on_gen' +// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'Foo' +pub type TypedefStruct = GenericStruct<u8>; + +impl TypedefStruct { + pub fn on_alias() {} +} + +impl std::ops::Deref for GenericStruct<u32> { + type Target = u32; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +pub struct Wrap<T>(GenericStruct<T>); + +// @has 'foo/type.Alias.html' +// @!has - '//h2' 'Methods from Deref<Target = u32>' +// @!has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl<T> Deref for Wrap<T>' +// @hasraw 'type.impl/foo/struct.Wrap.js' 'impl-Deref-for-Wrap%3CT%3E' +// Deref Methods aren't gathered for type aliases, though the actual impl is. +// @!hasraw 'type.impl/foo/struct.Wrap.js' 'BITS' +pub type Alias = Wrap<u32>; + +impl<T> std::ops::Deref for Wrap<T> { + type Target = GenericStruct<T>; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/tests/rustdoc/type-alias/same-crate-115718.rs b/tests/rustdoc/type-alias/same-crate-115718.rs new file mode 100644 index 000000000..26e5db85c --- /dev/null +++ b/tests/rustdoc/type-alias/same-crate-115718.rs @@ -0,0 +1,34 @@ +// https://github.com/rust-lang/rust/issues/115718 +#![crate_name = "foo"] + +pub trait MyTrait1 { + fn method_trait_1(); +} + +pub trait MyTrait2 { + fn method_trait_2(); +} + +pub struct MyStruct<T>(T); + +impl MyStruct<u32> { + pub fn method_u32() {} +} + +impl MyStruct<u16> { + pub fn method_u16() {} +} + +impl MyTrait1 for MyStruct<u32> { + fn method_trait_1() {} +} + +impl MyTrait2 for MyStruct<u16> { + fn method_trait_2() {} +} + +// @hasraw 'type.impl/foo/struct.MyStruct.js' 'method_u16' +// @!hasraw 'type.impl/foo/struct.MyStruct.js' 'method_u32' +// @!hasraw 'type.impl/foo/struct.MyStruct.js' 'method_trait_1' +// @hasraw 'type.impl/foo/struct.MyStruct.js' 'method_trait_2' +pub type MyType = MyStruct<u16>; diff --git a/tests/rustdoc/version-separator-without-source.rs b/tests/rustdoc/version-separator-without-source.rs index 04ea46a7f..4a855b7bb 100644 --- a/tests/rustdoc/version-separator-without-source.rs +++ b/tests/rustdoc/version-separator-without-source.rs @@ -4,20 +4,20 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' -// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub fn foo() {} // @has foo/struct.Bar.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' -// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub struct Bar; impl Bar { - // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0' - // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·' + // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0.0' + // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0.0 ·' #[stable(feature = "foobar", since = "2.0")] pub fn bar() {} } diff --git a/tests/rustdoc/where-clause-order.rs b/tests/rustdoc/where-clause-order.rs index b10f8f685..e3184b646 100644 --- a/tests/rustdoc/where-clause-order.rs +++ b/tests/rustdoc/where-clause-order.rs @@ -7,7 +7,7 @@ where } // @has 'foo/trait.SomeTrait.html' -// @has - "//*[@id='impl-SomeTrait%3C(A,+B,+C,+D,+E)%3E-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, " +// @has - "//*[@id='impl-SomeTrait-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, " impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E) where A: PartialOrd<A> + PartialEq<A>, @@ -17,3 +17,14 @@ where E: PartialOrd<E> + PartialEq<E> + ?Sized, { } + +// @has - "//*[@id='impl-SomeTrait%3C(A,+B,+C,+D)%3E-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, " +impl<A, B, C, D, E> SomeTrait<(A, B, C, D)> for (A, B, C, D, E) +where + A: PartialOrd<A> + PartialEq<A>, + B: PartialOrd<B> + PartialEq<B>, + C: PartialOrd<C> + PartialEq<C>, + D: PartialOrd<D> + PartialEq<D>, + E: PartialOrd<E> + PartialEq<E> + ?Sized, +{ +} diff --git a/tests/rustdoc/whitespace-after-where-clause.enum.html b/tests/rustdoc/whitespace-after-where-clause.enum.html index 20b60b68e..ff4971f33 100644 --- a/tests/rustdoc/whitespace-after-where-clause.enum.html +++ b/tests/rustdoc/whitespace-after-where-clause.enum.html @@ -1,5 +1,5 @@ <pre class="rust item-decl"><code>pub enum Cow<'a, B><span class="where fmt-newline">where - B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ + B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.enum2.html b/tests/rustdoc/whitespace-after-where-clause.enum2.html index 065ce757d..bfc50f8ad 100644 --- a/tests/rustdoc/whitespace-after-where-clause.enum2.html +++ b/tests/rustdoc/whitespace-after-where-clause.enum2.html @@ -1,4 +1,4 @@ -<pre class="rust item-decl"><code>pub enum Cow2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<pre class="rust item-decl"><code>pub enum Cow2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + 'a> { Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.rs b/tests/rustdoc/whitespace-after-where-clause.rs index b540c7c97..832d3728e 100644 --- a/tests/rustdoc/whitespace-after-where-clause.rs +++ b/tests/rustdoc/whitespace-after-where-clause.rs @@ -6,7 +6,8 @@ // @has 'foo/trait.ToOwned.html' // @snapshot trait - '//*[@class="rust item-decl"]' pub trait ToOwned<T> -where T: Clone +where + T: Clone, { type Owned; fn to_owned(&self) -> Self::Owned; @@ -26,7 +27,7 @@ pub trait ToOwned2<T: Clone> { // @snapshot enum - '//*[@class="rust item-decl"]' pub enum Cow<'a, B: ?Sized + 'a> where - B: ToOwned<Clone>, + B: ToOwned<()>, { Borrowed(&'a B), Whatever(u32), @@ -35,7 +36,7 @@ where // @has 'foo/enum.Cow2.html' // @snapshot enum2 - '//*[@class="rust item-decl"]' // There should be a whitespace before `{` in this case! -pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> { +pub enum Cow2<'a, B: ?Sized + ToOwned<()> + 'a> { Borrowed(&'a B), Whatever(u32), } @@ -44,7 +45,7 @@ pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> { // @snapshot struct - '//*[@class="rust item-decl"]' pub struct Struct<'a, B: ?Sized + 'a> where - B: ToOwned<Clone>, + B: ToOwned<()>, { pub a: &'a B, pub b: u32, @@ -53,7 +54,7 @@ where // @has 'foo/struct.Struct2.html' // @snapshot struct2 - '//*[@class="rust item-decl"]' // There should be a whitespace before `{` in this case! -pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> { +pub struct Struct2<'a, B: ?Sized + ToOwned<()> + 'a> { pub a: &'a B, pub b: u32, } @@ -62,7 +63,7 @@ pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> { // @snapshot union - '//*[@class="rust item-decl"]' pub union Union<'a, B: ?Sized + 'a> where - B: ToOwned<Clone>, + B: ToOwned<()>, { a: &'a B, b: u32, @@ -71,7 +72,7 @@ where // @has 'foo/union.Union2.html' // @snapshot union2 - '//*[@class="rust item-decl"]' // There should be a whitespace before `{` in this case! -pub union Union2<'a, B: ?Sized + ToOwned<Clone> + 'a> { +pub union Union2<'a, B: ?Sized + ToOwned<()> + 'a> { a: &'a B, b: u32, } diff --git a/tests/rustdoc/whitespace-after-where-clause.struct.html b/tests/rustdoc/whitespace-after-where-clause.struct.html index 948ddc499..ca6853586 100644 --- a/tests/rustdoc/whitespace-after-where-clause.struct.html +++ b/tests/rustdoc/whitespace-after-where-clause.struct.html @@ -1,5 +1,5 @@ <pre class="rust item-decl"><code>pub struct Struct<'a, B><span class="where fmt-newline">where - B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ + B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.struct2.html b/tests/rustdoc/whitespace-after-where-clause.struct2.html index c647e8d71..5aa8110c1 100644 --- a/tests/rustdoc/whitespace-after-where-clause.struct2.html +++ b/tests/rustdoc/whitespace-after-where-clause.struct2.html @@ -1,4 +1,4 @@ -<pre class="rust item-decl"><code>pub struct Struct2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<pre class="rust item-decl"><code>pub struct Struct2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + 'a> { pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.union.html b/tests/rustdoc/whitespace-after-where-clause.union.html index 38b6cb8b5..40b0c6712 100644 --- a/tests/rustdoc/whitespace-after-where-clause.union.html +++ b/tests/rustdoc/whitespace-after-where-clause.union.html @@ -1,4 +1,4 @@ <pre class="rust item-decl"><code>pub union Union<'a, B><span class="where fmt-newline">where - B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ + B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ /* private fields */ }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.union2.html b/tests/rustdoc/whitespace-after-where-clause.union2.html index 66ad30c92..177a161b8 100644 --- a/tests/rustdoc/whitespace-after-where-clause.union2.html +++ b/tests/rustdoc/whitespace-after-where-clause.union2.html @@ -1,3 +1,3 @@ -<pre class="rust item-decl"><code>pub union Union2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<pre class="rust item-decl"><code>pub union Union2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + 'a> { /* private fields */ }</code></pre>
\ No newline at end of file |