From b5c9982c0a0888bfc21e3a2c5c11575ecf2d1fb8 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 3 Jan 2024 14:56:10 -0700 Subject: Add `crate_name` and URL to test cases --- tests/rustdoc/issue-35169-2.rs | 5 +++- tests/rustdoc/issue-35169.rs | 5 +++- tests/rustdoc/issue-35488.rs | 9 +++++--- tests/rustdoc/issue-41783.rs | 5 +++- tests/rustdoc/issue-42760.rs | 5 +++- tests/rustdoc/issue-43869.rs | 27 ++++++++++++---------- tests/rustdoc/issue-46377.rs | 5 +++- tests/rustdoc/issue-46380-2.rs | 5 +++- tests/rustdoc/issue-46727.rs | 5 +++- .../rustdoc/issue-47197-blank-line-in-doc-block.rs | 5 +++- tests/rustdoc/issue-50159.rs | 5 +++- tests/rustdoc/issue-51236.rs | 5 +++- tests/rustdoc/issue-52873.rs | 3 +++ tests/rustdoc/issue-53689.rs | 1 + tests/rustdoc/issue-53812.rs | 5 +++- tests/rustdoc/issue-54478-demo-allocator.rs | 3 +++ tests/rustdoc/issue-54705.rs | 5 +++- tests/rustdoc/issue-55001.rs | 3 +++ tests/rustdoc/issue-55321.rs | 7 ++++-- tests/rustdoc/issue-55364.rs | 19 ++++++++------- 20 files changed, 95 insertions(+), 37 deletions(-) diff --git a/tests/rustdoc/issue-35169-2.rs b/tests/rustdoc/issue-35169-2.rs index f08466baf8b..c82323ddc6a 100644 --- a/tests/rustdoc/issue-35169-2.rs +++ b/tests/rustdoc/issue-35169-2.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/35169 +#![crate_name="foo"] + use std::ops::Deref; use std::ops::DerefMut; @@ -23,7 +26,7 @@ impl DerefMut for Bar { fn deref_mut(&mut self) -> &mut Foo { loop {} } } -// @has issue_35169_2/struct.Bar.html +// @has foo/struct.Bar.html // @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)' // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' // @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)' diff --git a/tests/rustdoc/issue-35169.rs b/tests/rustdoc/issue-35169.rs index 70a2265c806..44afaf2e903 100644 --- a/tests/rustdoc/issue-35169.rs +++ b/tests/rustdoc/issue-35169.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/35169 +#![crate_name="foo"] + use std::ops::Deref; pub struct Foo; @@ -18,7 +21,7 @@ impl Deref for Bar { fn deref(&self) -> &Foo { loop {} } } -// @has issue_35169/struct.Bar.html +// @has foo/struct.Bar.html // @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)' // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' // @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)' diff --git a/tests/rustdoc/issue-35488.rs b/tests/rustdoc/issue-35488.rs index c1bf9ceeac1..ed955dcd770 100644 --- a/tests/rustdoc/issue-35488.rs +++ b/tests/rustdoc/issue-35488.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/35488 +#![crate_name="foo"] + mod foo { pub enum Foo { Bar, @@ -5,9 +8,9 @@ mod foo { pub use self::Foo::*; } -// @has 'issue_35488/index.html' '//code' 'pub use self::Foo::*;' -// @has 'issue_35488/enum.Foo.html' +// @has 'foo/index.html' '//code' 'pub use self::Foo::*;' +// @has 'foo/enum.Foo.html' pub use self::foo::*; -// @has 'issue_35488/index.html' '//code' 'pub use std::option::Option::None;' +// @has 'foo/index.html' '//code' 'pub use std::option::Option::None;' pub use std::option::Option::None; diff --git a/tests/rustdoc/issue-41783.rs b/tests/rustdoc/issue-41783.rs index 7578d49daa5..7782e148fd9 100644 --- a/tests/rustdoc/issue-41783.rs +++ b/tests/rustdoc/issue-41783.rs @@ -1,4 +1,7 @@ -// @has issue_41783/struct.Foo.html +// https://github.com/rust-lang/rust/issues/41783 +#![crate_name="foo"] + +// @has foo/struct.Foo.html // @!hasraw - 'space' // @!hasraw - 'comment' // @hasraw - '#[outer]' diff --git a/tests/rustdoc/issue-42760.rs b/tests/rustdoc/issue-42760.rs index a5394c7d92a..16c1705eb00 100644 --- a/tests/rustdoc/issue-42760.rs +++ b/tests/rustdoc/issue-42760.rs @@ -1,6 +1,9 @@ +// https://github.com/rust-lang/rust/issues/42760 +#![crate_name="foo"] + #![allow(rustdoc::invalid_rust_codeblocks)] -// @has issue_42760/struct.NonGen.html +// @has foo/struct.NonGen.html // @has - '//h2' 'Example' /// Item docs. diff --git a/tests/rustdoc/issue-43869.rs b/tests/rustdoc/issue-43869.rs index 767d09d8558..9c4ed841f79 100644 --- a/tests/rustdoc/issue-43869.rs +++ b/tests/rustdoc/issue-43869.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/43869 +#![crate_name="foo"] + pub fn g() -> impl Iterator { Some(1u8).into_iter() } @@ -58,15 +61,15 @@ pub fn test_44731_4() -> Box> { Box::new(g()) } -// @has issue_43869/fn.g.html -// @has issue_43869/fn.h.html -// @has issue_43869/fn.i.html -// @has issue_43869/fn.j.html -// @has issue_43869/fn.k.html -// @has issue_43869/fn.l.html -// @has issue_43869/fn.m.html -// @has issue_43869/fn.n.html -// @has issue_43869/fn.o.html -// @has issue_43869/fn.test_44731_0.html -// @has issue_43869/fn.test_44731_1.html -// @has issue_43869/fn.test_44731_4.html +// @has foo/fn.g.html +// @has foo/fn.h.html +// @has foo/fn.i.html +// @has foo/fn.j.html +// @has foo/fn.k.html +// @has foo/fn.l.html +// @has foo/fn.m.html +// @has foo/fn.n.html +// @has foo/fn.o.html +// @has foo/fn.test_44731_0.html +// @has foo/fn.test_44731_1.html +// @has foo/fn.test_44731_4.html diff --git a/tests/rustdoc/issue-46377.rs b/tests/rustdoc/issue-46377.rs index 1311b4721e2..aec74f493d4 100644 --- a/tests/rustdoc/issue-46377.rs +++ b/tests/rustdoc/issue-46377.rs @@ -1,3 +1,6 @@ -// @has 'issue_46377/index.html' '//*[@class="desc docblock-short"]' 'Check out this struct!' +// https://github.com/rust-lang/rust/issues/46377 +#![crate_name="foo"] + +// @has 'foo/index.html' '//*[@class="desc docblock-short"]' 'Check out this struct!' /// # Check out this struct! pub struct SomeStruct; diff --git a/tests/rustdoc/issue-46380-2.rs b/tests/rustdoc/issue-46380-2.rs index 7004d18dc66..96ebd888eb5 100644 --- a/tests/rustdoc/issue-46380-2.rs +++ b/tests/rustdoc/issue-46380-2.rs @@ -1,6 +1,9 @@ +// https://github.com/rust-lang/rust/issues/46380 +#![crate_name="foo"] + pub trait PublicTrait {} -// @has issue_46380_2/struct.PublicStruct.html +// @has foo/struct.PublicStruct.html pub struct PublicStruct; // @!has - '//*[@class="impl"]' 'impl PublicTrait for PublicStruct' diff --git a/tests/rustdoc/issue-46727.rs b/tests/rustdoc/issue-46727.rs index 8cfc4827a7f..d0ce9c34f51 100644 --- a/tests/rustdoc/issue-46727.rs +++ b/tests/rustdoc/issue-46727.rs @@ -1,7 +1,10 @@ +// https://github.com/rust-lang/rust/issues/46727 +#![crate_name="foo"] + // aux-build:issue-46727.rs extern crate issue_46727; -// @has issue_46727/trait.Foo.html +// @has foo/trait.Foo.html // @has - '//h3[@class="code-header"]' 'impl Foo for Bar<[T; 3]>' pub use issue_46727::{Foo, Bar}; diff --git a/tests/rustdoc/issue-47197-blank-line-in-doc-block.rs b/tests/rustdoc/issue-47197-blank-line-in-doc-block.rs index 19994475de2..79492b4fa76 100644 --- a/tests/rustdoc/issue-47197-blank-line-in-doc-block.rs +++ b/tests/rustdoc/issue-47197-blank-line-in-doc-block.rs @@ -1,4 +1,7 @@ -// @has issue_47197_blank_line_in_doc_block/fn.whose_woods_these_are_i_think_i_know.html +// https://github.com/rust-lang/rust/issues/47197 +#![crate_name="foo"] + +// @has foo/fn.whose_woods_these_are_i_think_i_know.html /** * snow diff --git a/tests/rustdoc/issue-50159.rs b/tests/rustdoc/issue-50159.rs index 13bedd5dbb0..0663ed5fc81 100644 --- a/tests/rustdoc/issue-50159.rs +++ b/tests/rustdoc/issue-50159.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/50159 +#![crate_name="foo"] + pub trait Signal { type Item; } @@ -10,7 +13,7 @@ impl Signal2 for B where B: Signal { type Item2 = C; } -// @has issue_50159/struct.Switch.html +// @has foo/struct.Switch.html // @has - '//h3[@class="code-header"]' 'impl Send for Switchwhere ::Item: Send' // @has - '//h3[@class="code-header"]' 'impl Sync for Switchwhere ::Item: Sync' // @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0 diff --git a/tests/rustdoc/issue-51236.rs b/tests/rustdoc/issue-51236.rs index 04664805a88..30c81e79601 100644 --- a/tests/rustdoc/issue-51236.rs +++ b/tests/rustdoc/issue-51236.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/51236 +#![crate_name="foo"] + use std::marker::PhantomData; pub mod traits { @@ -6,7 +9,7 @@ pub mod traits { } } -// @has issue_51236/struct.Owned.html +// @has foo/struct.Owned.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl Send for Ownedwhere >::Reader: Send" pub struct Owned where T: for<'a> ::traits::Owned<'a> { diff --git a/tests/rustdoc/issue-52873.rs b/tests/rustdoc/issue-52873.rs index 8000ce73bd4..12d3e3d7f94 100644 --- a/tests/rustdoc/issue-52873.rs +++ b/tests/rustdoc/issue-52873.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/52873 +#![crate_name="foo"] + // Regression test for #52873. We used to ICE due to unexpected // overflows when checking for "blanket impl inclusion". diff --git a/tests/rustdoc/issue-53689.rs b/tests/rustdoc/issue-53689.rs index 832140e061b..7c2edd01a60 100644 --- a/tests/rustdoc/issue-53689.rs +++ b/tests/rustdoc/issue-53689.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/53689 // aux-build:issue-53689.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-53812.rs b/tests/rustdoc/issue-53812.rs index dc1eb304c3d..968ae035043 100644 --- a/tests/rustdoc/issue-53812.rs +++ b/tests/rustdoc/issue-53812.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/53812 +#![crate_name="foo"] + pub trait MyIterator {} pub struct MyStruct(T); @@ -11,7 +14,7 @@ macro_rules! array_impls { } } -// @has issue_53812/trait.MyIterator.html +// @has foo/trait.MyIterator.html // @has - '//*[@id="implementors-list"]/*[@class="impl"][1]' 'MyStruct<[T; 0]>' // @has - '//*[@id="implementors-list"]/*[@class="impl"][2]' 'MyStruct<[T; 1]>' // @has - '//*[@id="implementors-list"]/*[@class="impl"][3]' 'MyStruct<[T; 2]>' diff --git a/tests/rustdoc/issue-54478-demo-allocator.rs b/tests/rustdoc/issue-54478-demo-allocator.rs index 4811f363bc9..39acee36d88 100644 --- a/tests/rustdoc/issue-54478-demo-allocator.rs +++ b/tests/rustdoc/issue-54478-demo-allocator.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/54478 +#![crate_name="foo"] + // Issue #54478: regression test showing that we can demonstrate // `#[global_allocator]` in code blocks built by `rustdoc`. // diff --git a/tests/rustdoc/issue-54705.rs b/tests/rustdoc/issue-54705.rs index a886eb0de24..00be0042fb0 100644 --- a/tests/rustdoc/issue-54705.rs +++ b/tests/rustdoc/issue-54705.rs @@ -1,6 +1,9 @@ +// https://github.com/rust-lang/rust/issues/54705 +#![crate_name="foo"] + pub trait ScopeHandle<'scope> {} -// @has issue_54705/struct.ScopeFutureContents.html +// @has foo/struct.ScopeFutureContents.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<'scope, S> Send for ScopeFutureContents<'scope, S>where S: Sync" // diff --git a/tests/rustdoc/issue-55001.rs b/tests/rustdoc/issue-55001.rs index f6c7f9a3d08..b7d86a1c843 100644 --- a/tests/rustdoc/issue-55001.rs +++ b/tests/rustdoc/issue-55001.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/55001 +#![crate_name="foo"] + // Regression test for issue #55001. Previously, we would incorrectly // cache certain trait selection results when checking for blanket impls, // resulting in an ICE when we tried to confirm the cached ParamCandidate diff --git a/tests/rustdoc/issue-55321.rs b/tests/rustdoc/issue-55321.rs index d3c2070d915..e9be1ff854e 100644 --- a/tests/rustdoc/issue-55321.rs +++ b/tests/rustdoc/issue-55321.rs @@ -1,6 +1,9 @@ +// https://github.com/rust-lang/rust/issues/55321 +#![crate_name="foo"] + #![feature(negative_impls)] -// @has issue_55321/struct.A.html +// @has foo/struct.A.html // @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl !Send for A" // @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ @@ -10,7 +13,7 @@ pub struct A(); impl !Send for A {} impl !Sync for A {} -// @has issue_55321/struct.B.html +// @has foo/struct.B.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl !Send for B" // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ diff --git a/tests/rustdoc/issue-55364.rs b/tests/rustdoc/issue-55364.rs index 941cb3ce1ca..c07aba628c9 100644 --- a/tests/rustdoc/issue-55364.rs +++ b/tests/rustdoc/issue-55364.rs @@ -1,6 +1,9 @@ +// https://github.com/rust-lang/rust/issues/55364 +#![crate_name="foo"] + // First a module with inner documentation -// @has issue_55364/subone/index.html +// @has foo/subone/index.html // These foo/bar links in the module's documentation should refer inside `subone` // @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' @@ -8,12 +11,12 @@ pub mod subone { //! See either [foo] or [bar]. // This should refer to subone's `bar` - // @has issue_55364/subone/fn.foo.html + // @has foo/subone/fn.foo.html // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' /// See [bar] pub fn foo() {} // This should refer to subone's `foo` - // @has issue_55364/subone/fn.bar.html + // @has foo/subone/fn.bar.html // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' /// See [foo] pub fn bar() {} @@ -21,7 +24,7 @@ pub mod subone { // A module with outer documentation -// @has issue_55364/subtwo/index.html +// @has foo/subtwo/index.html // These foo/bar links in the module's documentation should not reference inside `subtwo` // @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' // @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' @@ -36,13 +39,13 @@ pub mod subtwo { // Despite the module's docs referring to the top level foo/bar, // this should refer to subtwo's `bar` - // @has issue_55364/subtwo/fn.foo.html + // @has foo/subtwo/fn.foo.html // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' /// See [bar] pub fn foo() {} // Despite the module's docs referring to the top level foo/bar, // this should refer to subtwo's `foo` - // @has issue_55364/subtwo/fn.bar.html + // @has foo/subtwo/fn.bar.html // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' /// See [foo] pub fn bar() {} @@ -57,7 +60,7 @@ pub fn bar() {} // This module refers to the outer foo/bar by means of `super::` -// @has issue_55364/subthree/index.html +// @has foo/subthree/index.html // This module should also refer to the top level foo/bar // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' @@ -67,7 +70,7 @@ pub mod subthree { // Next we go *deeper* - In order to ensure it's not just "this or parent" // we test `crate::` and a `super::super::...` chain -// @has issue_55364/subfour/subfive/subsix/subseven/subeight/index.html +// @has foo/subfour/subfive/subsix/subseven/subeight/index.html // @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo' // @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar' pub mod subfour { -- cgit 1.4.1-3-g733a5 From 35830fe218f245ef4a82199b8ee371fa89a52721 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 3 Jan 2024 15:30:09 -0700 Subject: rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 5) --- tests/rustdoc-ui/ice-blanket-impl-52873.rs | 174 +++++++++++++++++++++ .../rustdoc-ui/ice-blanket-impl-selection-55001.rs | 34 ++++ .../auto-trait-bounds-by-associated-type-50159.rs | 23 +++ .../auto-trait-bounds-inference-variables-54705.rs | 30 ++++ tests/rustdoc/auto-trait-bounds-where-51236.rs | 17 ++ tests/rustdoc/auto-trait-negative-impl-55321.rs | 21 +++ tests/rustdoc/auxiliary/issue-46727.rs | 7 - tests/rustdoc/blank-line-in-doc-block-47197.rs | 11 ++ tests/rustdoc/demo-allocator-54478.rs | 45 ++++++ tests/rustdoc/deref-mut-35169-2.rs | 43 +++++ tests/rustdoc/deref-mut-35169.rs | 38 +++++ tests/rustdoc/doc-attr-comment-mix-42760.rs | 18 +++ .../doctest-escape-boring-41783.codeblock.html | 5 + .../rustdoc/doctest/doctest-escape-boring-41783.rs | 22 +++ tests/rustdoc/enum-variant-reexport-35488.rs | 16 ++ tests/rustdoc/impl-blanket-53689.rs | 17 ++ tests/rustdoc/impl-trait-43869.rs | 75 +++++++++ .../rustdoc/inline_cross/auxiliary/issue-46727.rs | 7 + tests/rustdoc/inline_cross/const-eval-46727.rs | 10 ++ .../module-scope-name-resolution-55364.rs | 89 +++++++++++ tests/rustdoc/issue-35169-2.rs | 43 ----- tests/rustdoc/issue-35169.rs | 38 ----- tests/rustdoc/issue-35488.rs | 16 -- tests/rustdoc/issue-41783.codeblock.html | 5 - tests/rustdoc/issue-41783.rs | 22 --- tests/rustdoc/issue-42760.rs | 18 --- tests/rustdoc/issue-43869.rs | 75 --------- tests/rustdoc/issue-46377.rs | 6 - tests/rustdoc/issue-46380-2.rs | 12 -- tests/rustdoc/issue-46727.rs | 10 -- .../rustdoc/issue-47197-blank-line-in-doc-block.rs | 11 -- tests/rustdoc/issue-50159.rs | 23 --- tests/rustdoc/issue-51236.rs | 17 -- tests/rustdoc/issue-52873.rs | 174 --------------------- tests/rustdoc/issue-53689.rs | 17 -- tests/rustdoc/issue-53812.rs | 23 --- tests/rustdoc/issue-54478-demo-allocator.rs | 45 ------ tests/rustdoc/issue-54705.rs | 30 ---- tests/rustdoc/issue-55001.rs | 34 ---- tests/rustdoc/issue-55321.rs | 21 --- tests/rustdoc/issue-55364.rs | 89 ----------- .../public-impl-mention-private-generic-46380-2.rs | 12 ++ tests/rustdoc/sort-53812.rs | 23 +++ tests/rustdoc/summary-header-46377.rs | 6 + 44 files changed, 736 insertions(+), 736 deletions(-) create mode 100644 tests/rustdoc-ui/ice-blanket-impl-52873.rs create mode 100644 tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs create mode 100644 tests/rustdoc/auto-trait-bounds-by-associated-type-50159.rs create mode 100644 tests/rustdoc/auto-trait-bounds-inference-variables-54705.rs create mode 100644 tests/rustdoc/auto-trait-bounds-where-51236.rs create mode 100644 tests/rustdoc/auto-trait-negative-impl-55321.rs delete mode 100644 tests/rustdoc/auxiliary/issue-46727.rs create mode 100644 tests/rustdoc/blank-line-in-doc-block-47197.rs create mode 100644 tests/rustdoc/demo-allocator-54478.rs create mode 100644 tests/rustdoc/deref-mut-35169-2.rs create mode 100644 tests/rustdoc/deref-mut-35169.rs create mode 100644 tests/rustdoc/doc-attr-comment-mix-42760.rs create mode 100644 tests/rustdoc/doctest/doctest-escape-boring-41783.codeblock.html create mode 100644 tests/rustdoc/doctest/doctest-escape-boring-41783.rs create mode 100644 tests/rustdoc/enum-variant-reexport-35488.rs create mode 100644 tests/rustdoc/impl-blanket-53689.rs create mode 100644 tests/rustdoc/impl-trait-43869.rs create mode 100644 tests/rustdoc/inline_cross/auxiliary/issue-46727.rs create mode 100644 tests/rustdoc/inline_cross/const-eval-46727.rs create mode 100644 tests/rustdoc/intra-doc/module-scope-name-resolution-55364.rs delete mode 100644 tests/rustdoc/issue-35169-2.rs delete mode 100644 tests/rustdoc/issue-35169.rs delete mode 100644 tests/rustdoc/issue-35488.rs delete mode 100644 tests/rustdoc/issue-41783.codeblock.html delete mode 100644 tests/rustdoc/issue-41783.rs delete mode 100644 tests/rustdoc/issue-42760.rs delete mode 100644 tests/rustdoc/issue-43869.rs delete mode 100644 tests/rustdoc/issue-46377.rs delete mode 100644 tests/rustdoc/issue-46380-2.rs delete mode 100644 tests/rustdoc/issue-46727.rs delete mode 100644 tests/rustdoc/issue-47197-blank-line-in-doc-block.rs delete mode 100644 tests/rustdoc/issue-50159.rs delete mode 100644 tests/rustdoc/issue-51236.rs delete mode 100644 tests/rustdoc/issue-52873.rs delete mode 100644 tests/rustdoc/issue-53689.rs delete mode 100644 tests/rustdoc/issue-53812.rs delete mode 100644 tests/rustdoc/issue-54478-demo-allocator.rs delete mode 100644 tests/rustdoc/issue-54705.rs delete mode 100644 tests/rustdoc/issue-55001.rs delete mode 100644 tests/rustdoc/issue-55321.rs delete mode 100644 tests/rustdoc/issue-55364.rs create mode 100644 tests/rustdoc/public-impl-mention-private-generic-46380-2.rs create mode 100644 tests/rustdoc/sort-53812.rs create mode 100644 tests/rustdoc/summary-header-46377.rs diff --git a/tests/rustdoc-ui/ice-blanket-impl-52873.rs b/tests/rustdoc-ui/ice-blanket-impl-52873.rs new file mode 100644 index 00000000000..12d3e3d7f94 --- /dev/null +++ b/tests/rustdoc-ui/ice-blanket-impl-52873.rs @@ -0,0 +1,174 @@ +// https://github.com/rust-lang/rust/issues/52873 +#![crate_name="foo"] + +// Regression test for #52873. We used to ICE due to unexpected +// overflows when checking for "blanket impl inclusion". + +use std::marker::PhantomData; +use std::cmp::Ordering; +use std::ops::{Add, Mul}; + +pub type True = B1; +pub type False = B0; +pub type U0 = UTerm; +pub type U1 = UInt; + +pub trait NonZero {} + +pub trait Bit { +} + +pub trait Unsigned { +} + +#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)] +pub struct B0; + +impl B0 { + #[inline] + pub fn new() -> B0 { + B0 + } +} + +#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)] +pub struct B1; + +impl B1 { + #[inline] + pub fn new() -> B1 { + B1 + } +} + +impl Bit for B0 { +} + +impl Bit for B1 { +} + +impl NonZero for B1 {} + +pub trait PrivatePow { + type Output; +} +pub type PrivatePowOut = >::Output; + +pub type Add1 = >::Output; +pub type Prod = >::Output; +pub type Square = ::Output; +pub type Sum = >::Output; + +#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)] +pub struct UTerm; + +impl UTerm { + #[inline] + pub fn new() -> UTerm { + UTerm + } +} + +impl Unsigned for UTerm { +} + +#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)] +pub struct UInt { + _marker: PhantomData<(U, B)>, +} + +impl UInt { + #[inline] + pub fn new() -> UInt { + UInt { + _marker: PhantomData, + } + } +} + +impl Unsigned for UInt { +} + +impl NonZero for UInt {} + +impl Add for UTerm { + type Output = UTerm; + fn add(self, _: B0) -> Self::Output { + UTerm + } +} + +impl Add for UInt { + type Output = UInt; + fn add(self, _: B0) -> Self::Output { + UInt::new() + } +} + +impl Add for UTerm { + type Output = U; + fn add(self, _: U) -> Self::Output { + unimplemented!() + } +} + +impl Mul for UInt { + type Output = UTerm; + fn mul(self, _: B0) -> Self::Output { + UTerm + } +} + +impl Mul for UInt { + type Output = UInt; + fn mul(self, _: B1) -> Self::Output { + UInt::new() + } +} + +impl Mul for UTerm { + type Output = UTerm; + fn mul(self, _: U) -> Self::Output { + UTerm + } +} + +impl Mul> for UInt +where + Ul: Mul>, +{ + type Output = UInt>, B0>; + fn mul(self, _: UInt) -> Self::Output { + unimplemented!() + } +} + +pub trait Pow { + type Output; +} + +impl Pow for X +where + X: PrivatePow, +{ + type Output = PrivatePowOut; +} + +impl PrivatePow for X { + type Output = Y; +} + +impl PrivatePow for X +where + X: Mul, +{ + type Output = Prod; +} + +impl PrivatePow, B0>> for X +where + X: Mul, + Square: PrivatePow>, +{ + type Output = PrivatePowOut, Y, UInt>; +} diff --git a/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs b/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs new file mode 100644 index 00000000000..b7d86a1c843 --- /dev/null +++ b/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs @@ -0,0 +1,34 @@ +// https://github.com/rust-lang/rust/issues/55001 +#![crate_name="foo"] + +// Regression test for issue #55001. Previously, we would incorrectly +// cache certain trait selection results when checking for blanket impls, +// resulting in an ICE when we tried to confirm the cached ParamCandidate +// against an obligation. + +pub struct DefaultAllocator; +pub struct Standard; +pub struct Inner; + +pub trait Rand {} + +pub trait Distribution {} +pub trait Allocator {} + +impl Rand for T where Standard: Distribution {} + +impl Distribution> for Standard +where +DefaultAllocator: Allocator, +Standard: Distribution {} + +impl Distribution for Standard {} + + +pub struct Point +where DefaultAllocator: Allocator +{ + field: N +} + +fn main() {} diff --git a/tests/rustdoc/auto-trait-bounds-by-associated-type-50159.rs b/tests/rustdoc/auto-trait-bounds-by-associated-type-50159.rs new file mode 100644 index 00000000000..0663ed5fc81 --- /dev/null +++ b/tests/rustdoc/auto-trait-bounds-by-associated-type-50159.rs @@ -0,0 +1,23 @@ +// https://github.com/rust-lang/rust/issues/50159 +#![crate_name="foo"] + +pub trait Signal { + type Item; +} + +pub trait Signal2 { + type Item2; +} + +impl Signal2 for B where B: Signal { + type Item2 = C; +} + +// @has foo/struct.Switch.html +// @has - '//h3[@class="code-header"]' 'impl Send for Switchwhere ::Item: Send' +// @has - '//h3[@class="code-header"]' 'impl Sync for Switchwhere ::Item: Sync' +// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0 +// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 5 +pub struct Switch { + pub inner: ::Item2, +} diff --git a/tests/rustdoc/auto-trait-bounds-inference-variables-54705.rs b/tests/rustdoc/auto-trait-bounds-inference-variables-54705.rs new file mode 100644 index 00000000000..00be0042fb0 --- /dev/null +++ b/tests/rustdoc/auto-trait-bounds-inference-variables-54705.rs @@ -0,0 +1,30 @@ +// https://github.com/rust-lang/rust/issues/54705 +#![crate_name="foo"] + +pub trait ScopeHandle<'scope> {} + +// @has foo/struct.ScopeFutureContents.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl<'scope, S> Send for ScopeFutureContents<'scope, S>where S: Sync" +// +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl<'scope, S> Sync for ScopeFutureContents<'scope, S>where S: Sync" +pub struct ScopeFutureContents<'scope, S> + where S: ScopeHandle<'scope>, +{ + dummy: &'scope S, + this: Box>, +} + +struct ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{ + contents: ScopeFutureContents<'scope, S>, +} + +unsafe impl<'scope, S> Send for ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{} +unsafe impl<'scope, S> Sync for ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{} diff --git a/tests/rustdoc/auto-trait-bounds-where-51236.rs b/tests/rustdoc/auto-trait-bounds-where-51236.rs new file mode 100644 index 00000000000..30c81e79601 --- /dev/null +++ b/tests/rustdoc/auto-trait-bounds-where-51236.rs @@ -0,0 +1,17 @@ +// https://github.com/rust-lang/rust/issues/51236 +#![crate_name="foo"] + +use std::marker::PhantomData; + +pub mod traits { + pub trait Owned<'a> { + type Reader; + } +} + +// @has foo/struct.Owned.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Send for Ownedwhere >::Reader: Send" +pub struct Owned where T: for<'a> ::traits::Owned<'a> { + marker: PhantomData<>::Reader>, +} diff --git a/tests/rustdoc/auto-trait-negative-impl-55321.rs b/tests/rustdoc/auto-trait-negative-impl-55321.rs new file mode 100644 index 00000000000..e9be1ff854e --- /dev/null +++ b/tests/rustdoc/auto-trait-negative-impl-55321.rs @@ -0,0 +1,21 @@ +// https://github.com/rust-lang/rust/issues/55321 +#![crate_name="foo"] + +#![feature(negative_impls)] + +// @has foo/struct.A.html +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl !Send for A" +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl !Sync for A" +pub struct A(); + +impl !Send for A {} +impl !Sync for A {} + +// @has foo/struct.B.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl !Send for B" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl !Sync for B" +pub struct B(A, Box); diff --git a/tests/rustdoc/auxiliary/issue-46727.rs b/tests/rustdoc/auxiliary/issue-46727.rs deleted file mode 100644 index 30dccfa77b5..00000000000 --- a/tests/rustdoc/auxiliary/issue-46727.rs +++ /dev/null @@ -1,7 +0,0 @@ -// compile-flags: -Cmetadata=aux - -pub trait Foo {} - -pub struct Bar { x: T } - -impl Foo for Bar<[T; 1 + 1 + 1]> {} diff --git a/tests/rustdoc/blank-line-in-doc-block-47197.rs b/tests/rustdoc/blank-line-in-doc-block-47197.rs new file mode 100644 index 00000000000..79492b4fa76 --- /dev/null +++ b/tests/rustdoc/blank-line-in-doc-block-47197.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/47197 +#![crate_name="foo"] + +// @has foo/fn.whose_woods_these_are_i_think_i_know.html + +/** +* snow + +* ice +*/ +pub fn whose_woods_these_are_i_think_i_know() {} diff --git a/tests/rustdoc/demo-allocator-54478.rs b/tests/rustdoc/demo-allocator-54478.rs new file mode 100644 index 00000000000..39acee36d88 --- /dev/null +++ b/tests/rustdoc/demo-allocator-54478.rs @@ -0,0 +1,45 @@ +// https://github.com/rust-lang/rust/issues/54478 +#![crate_name="foo"] + +// Issue #54478: regression test showing that we can demonstrate +// `#[global_allocator]` in code blocks built by `rustdoc`. +// +// ## Background +// +// Changes in lang-item visibility injected failures that were only +// exposed when compiling with `-C prefer-dynamic`. But `rustdoc` used +// `-C prefer-dynamic` (and had done so for years, for reasons we did +// not document at that time). +// +// Rather than try to revise the visbility semanics, we instead +// decided to change `rustdoc` to behave more like the compiler's +// default setting, by leaving off `-C prefer-dynamic`. + +// compile-flags:--test + +//! This is a doc comment +//! +//! ```rust +//! use std::alloc::*; +//! +//! #[global_allocator] +//! static ALLOC: A = A; +//! +//! static mut HIT: bool = false; +//! +//! struct A; +//! +//! unsafe impl GlobalAlloc for A { +//! unsafe fn alloc(&self, layout: Layout) -> *mut u8 { +//! HIT = true; +//! System.alloc(layout) +//! } +//! unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { +//! System.dealloc(ptr, layout); +//! } +//! } +//! +//! fn main() { +//! assert!(unsafe { HIT }); +//! } +//! ``` diff --git a/tests/rustdoc/deref-mut-35169-2.rs b/tests/rustdoc/deref-mut-35169-2.rs new file mode 100644 index 00000000000..c82323ddc6a --- /dev/null +++ b/tests/rustdoc/deref-mut-35169-2.rs @@ -0,0 +1,43 @@ +// https://github.com/rust-lang/rust/issues/35169 +#![crate_name="foo"] + +use std::ops::Deref; +use std::ops::DerefMut; + +pub struct Foo; +pub struct Bar; + +impl Foo { + pub fn by_ref(&self) {} + pub fn by_explicit_ref(self: &Foo) {} + pub fn by_mut_ref(&mut self) {} + pub fn by_explicit_mut_ref(self: &mut Foo) {} + pub fn by_explicit_box(self: Box) {} + pub fn by_explicit_self_box(self: Box) {} + pub fn static_foo() {} +} + +impl Deref for Bar { + type Target = Foo; + fn deref(&self) -> &Foo { loop {} } +} + +impl DerefMut for Bar { + fn deref_mut(&mut self) -> &mut Foo { loop {} } +} + +// @has foo/struct.Bar.html +// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)' +// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' +// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)' +// @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' +// @has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)' +// @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' +// @has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)' +// @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' +// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' +// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/tests/rustdoc/deref-mut-35169.rs b/tests/rustdoc/deref-mut-35169.rs new file mode 100644 index 00000000000..44afaf2e903 --- /dev/null +++ b/tests/rustdoc/deref-mut-35169.rs @@ -0,0 +1,38 @@ +// https://github.com/rust-lang/rust/issues/35169 +#![crate_name="foo"] + +use std::ops::Deref; + +pub struct Foo; +pub struct Bar; + +impl Foo { + pub fn by_ref(&self) {} + pub fn by_explicit_ref(self: &Foo) {} + pub fn by_mut_ref(&mut self) {} + pub fn by_explicit_mut_ref(self: &mut Foo) {} + pub fn by_explicit_box(self: Box) {} + pub fn by_explicit_self_box(self: Box) {} + pub fn static_foo() {} +} + +impl Deref for Bar { + type Target = Foo; + fn deref(&self) -> &Foo { loop {} } +} + +// @has foo/struct.Bar.html +// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)' +// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' +// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)' +// @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' +// @!has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)' +// @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' +// @!has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)' +// @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' +// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' +// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/tests/rustdoc/doc-attr-comment-mix-42760.rs b/tests/rustdoc/doc-attr-comment-mix-42760.rs new file mode 100644 index 00000000000..16c1705eb00 --- /dev/null +++ b/tests/rustdoc/doc-attr-comment-mix-42760.rs @@ -0,0 +1,18 @@ +// https://github.com/rust-lang/rust/issues/42760 +#![crate_name="foo"] + +#![allow(rustdoc::invalid_rust_codeblocks)] + +// @has foo/struct.NonGen.html +// @has - '//h2' 'Example' + +/// Item docs. +/// +#[doc="Hello there!"] +/// +/// # Example +/// +/// ```rust +/// // some code here +/// ``` +pub struct NonGen; diff --git a/tests/rustdoc/doctest/doctest-escape-boring-41783.codeblock.html b/tests/rustdoc/doctest/doctest-escape-boring-41783.codeblock.html new file mode 100644 index 00000000000..3bca4536cd5 --- /dev/null +++ b/tests/rustdoc/doctest/doctest-escape-boring-41783.codeblock.html @@ -0,0 +1,5 @@ +# single +## double +### triple +#[outer] +#![inner] diff --git a/tests/rustdoc/doctest/doctest-escape-boring-41783.rs b/tests/rustdoc/doctest/doctest-escape-boring-41783.rs new file mode 100644 index 00000000000..7782e148fd9 --- /dev/null +++ b/tests/rustdoc/doctest/doctest-escape-boring-41783.rs @@ -0,0 +1,22 @@ +// https://github.com/rust-lang/rust/issues/41783 +#![crate_name="foo"] + +// @has foo/struct.Foo.html +// @!hasraw - 'space' +// @!hasraw - 'comment' +// @hasraw - '#[outer]' +// @!hasraw - '#[outer]' +// @hasraw - '#![inner]' +// @!hasraw - '#![inner]' +// @snapshot 'codeblock' - '//*[@class="toggle top-doc"]/*[@class="docblock"]//pre/code' + +/// ```no_run +/// # # space +/// # comment +/// ## single +/// ### double +/// #### triple +/// ##[outer] +/// ##![inner] +/// ``` +pub struct Foo; diff --git a/tests/rustdoc/enum-variant-reexport-35488.rs b/tests/rustdoc/enum-variant-reexport-35488.rs new file mode 100644 index 00000000000..ed955dcd770 --- /dev/null +++ b/tests/rustdoc/enum-variant-reexport-35488.rs @@ -0,0 +1,16 @@ +// https://github.com/rust-lang/rust/issues/35488 +#![crate_name="foo"] + +mod foo { + pub enum Foo { + Bar, + } + pub use self::Foo::*; +} + +// @has 'foo/index.html' '//code' 'pub use self::Foo::*;' +// @has 'foo/enum.Foo.html' +pub use self::foo::*; + +// @has 'foo/index.html' '//code' 'pub use std::option::Option::None;' +pub use std::option::Option::None; diff --git a/tests/rustdoc/impl-blanket-53689.rs b/tests/rustdoc/impl-blanket-53689.rs new file mode 100644 index 00000000000..7c2edd01a60 --- /dev/null +++ b/tests/rustdoc/impl-blanket-53689.rs @@ -0,0 +1,17 @@ +// https://github.com/rust-lang/rust/issues/53689 +// aux-build:issue-53689.rs + +#![crate_name = "foo"] + +extern crate issue_53689; + +// @has foo/trait.MyTrait.html +// @!hasraw - 'MyStruct' +// @count - '//*[h3="impl MyTrait for T"]' 1 +pub trait MyTrait {} + +impl MyTrait for T {} + +mod a { + pub use issue_53689::MyStruct; +} diff --git a/tests/rustdoc/impl-trait-43869.rs b/tests/rustdoc/impl-trait-43869.rs new file mode 100644 index 00000000000..9c4ed841f79 --- /dev/null +++ b/tests/rustdoc/impl-trait-43869.rs @@ -0,0 +1,75 @@ +// https://github.com/rust-lang/rust/issues/43869 +#![crate_name="foo"] + +pub fn g() -> impl Iterator { + Some(1u8).into_iter() +} + +#[allow(unused_parens)] +pub fn h() -> (impl Iterator) { + Some(1u8).into_iter() +} + +pub fn i() -> impl Iterator + 'static { + Some(1u8).into_iter() +} + +pub fn j() -> impl Iterator + Clone { + Some(1u8).into_iter() +} + +pub fn k() -> [impl Clone; 2] { + [123u32, 456u32] +} + +pub fn l() -> (impl Clone, impl Default) { + (789u32, -123i32) +} + +pub fn m() -> &'static impl Clone { + &1u8 +} + +pub fn n() -> *const impl Clone { + &1u8 +} + +pub fn o() -> &'static [impl Clone] { + b":)" +} + +// issue #44731 +pub fn test_44731_0() -> Box> { + Box::new(g()) +} + +pub fn test_44731_1() -> Result, ()> { + Ok(Box::new(j())) +} + +// NOTE these involve Fn sugar, where impl Trait is disallowed for now, see issue #45994 +// +//pub fn test_44731_2() -> Box { +// Box::new(|_: u32| {}) +//} +// +//pub fn test_44731_3() -> Box impl Clone> { +// Box::new(|| 0u32) +//} + +pub fn test_44731_4() -> Box> { + Box::new(g()) +} + +// @has foo/fn.g.html +// @has foo/fn.h.html +// @has foo/fn.i.html +// @has foo/fn.j.html +// @has foo/fn.k.html +// @has foo/fn.l.html +// @has foo/fn.m.html +// @has foo/fn.n.html +// @has foo/fn.o.html +// @has foo/fn.test_44731_0.html +// @has foo/fn.test_44731_1.html +// @has foo/fn.test_44731_4.html diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs b/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs new file mode 100644 index 00000000000..30dccfa77b5 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs @@ -0,0 +1,7 @@ +// compile-flags: -Cmetadata=aux + +pub trait Foo {} + +pub struct Bar { x: T } + +impl Foo for Bar<[T; 1 + 1 + 1]> {} diff --git a/tests/rustdoc/inline_cross/const-eval-46727.rs b/tests/rustdoc/inline_cross/const-eval-46727.rs new file mode 100644 index 00000000000..d0ce9c34f51 --- /dev/null +++ b/tests/rustdoc/inline_cross/const-eval-46727.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/46727 +#![crate_name="foo"] + +// aux-build:issue-46727.rs + +extern crate issue_46727; + +// @has foo/trait.Foo.html +// @has - '//h3[@class="code-header"]' 'impl Foo for Bar<[T; 3]>' +pub use issue_46727::{Foo, Bar}; diff --git a/tests/rustdoc/intra-doc/module-scope-name-resolution-55364.rs b/tests/rustdoc/intra-doc/module-scope-name-resolution-55364.rs new file mode 100644 index 00000000000..c07aba628c9 --- /dev/null +++ b/tests/rustdoc/intra-doc/module-scope-name-resolution-55364.rs @@ -0,0 +1,89 @@ +// https://github.com/rust-lang/rust/issues/55364 +#![crate_name="foo"] + +// First a module with inner documentation + +// @has foo/subone/index.html +// These foo/bar links in the module's documentation should refer inside `subone` +// @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' +// @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' +pub mod subone { + //! See either [foo] or [bar]. + + // This should refer to subone's `bar` + // @has foo/subone/fn.foo.html + // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' + /// See [bar] + pub fn foo() {} + // This should refer to subone's `foo` + // @has foo/subone/fn.bar.html + // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' + /// See [foo] + pub fn bar() {} +} + +// A module with outer documentation + +// @has foo/subtwo/index.html +// These foo/bar links in the module's documentation should not reference inside `subtwo` +// @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' +// @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' +// Instead it should be referencing the top level functions +// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' +// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' +// Though there should be such links later +// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.foo.html"]' 'foo' +// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.bar.html"]' 'bar' +/// See either [foo] or [bar]. +pub mod subtwo { + + // Despite the module's docs referring to the top level foo/bar, + // this should refer to subtwo's `bar` + // @has foo/subtwo/fn.foo.html + // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' + /// See [bar] + pub fn foo() {} + // Despite the module's docs referring to the top level foo/bar, + // this should refer to subtwo's `foo` + // @has foo/subtwo/fn.bar.html + // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' + /// See [foo] + pub fn bar() {} +} + +// These are the function referred to by the module above with outer docs + +/// See [bar] +pub fn foo() {} +/// See [foo] +pub fn bar() {} + +// This module refers to the outer foo/bar by means of `super::` + +// @has foo/subthree/index.html +// This module should also refer to the top level foo/bar +// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' +// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' +pub mod subthree { + //! See either [foo][super::foo] or [bar][super::bar] +} + +// Next we go *deeper* - In order to ensure it's not just "this or parent" +// we test `crate::` and a `super::super::...` chain +// @has foo/subfour/subfive/subsix/subseven/subeight/index.html +// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo' +// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar' +pub mod subfour { + pub mod subfive { + pub mod subsix { + pub mod subseven { + pub mod subeight { + /// See [other foo][crate::subone::foo] + pub fn foo() {} + /// See [other bar][super::super::super::super::super::subtwo::bar] + pub fn bar() {} + } + } + } + } +} diff --git a/tests/rustdoc/issue-35169-2.rs b/tests/rustdoc/issue-35169-2.rs deleted file mode 100644 index c82323ddc6a..00000000000 --- a/tests/rustdoc/issue-35169-2.rs +++ /dev/null @@ -1,43 +0,0 @@ -// https://github.com/rust-lang/rust/issues/35169 -#![crate_name="foo"] - -use std::ops::Deref; -use std::ops::DerefMut; - -pub struct Foo; -pub struct Bar; - -impl Foo { - pub fn by_ref(&self) {} - pub fn by_explicit_ref(self: &Foo) {} - pub fn by_mut_ref(&mut self) {} - pub fn by_explicit_mut_ref(self: &mut Foo) {} - pub fn by_explicit_box(self: Box) {} - pub fn by_explicit_self_box(self: Box) {} - pub fn static_foo() {} -} - -impl Deref for Bar { - type Target = Foo; - fn deref(&self) -> &Foo { loop {} } -} - -impl DerefMut for Bar { - fn deref_mut(&mut self) -> &mut Foo { loop {} } -} - -// @has foo/struct.Bar.html -// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)' -// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' -// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)' -// @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' -// @has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)' -// @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' -// @has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' -// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/tests/rustdoc/issue-35169.rs b/tests/rustdoc/issue-35169.rs deleted file mode 100644 index 44afaf2e903..00000000000 --- a/tests/rustdoc/issue-35169.rs +++ /dev/null @@ -1,38 +0,0 @@ -// https://github.com/rust-lang/rust/issues/35169 -#![crate_name="foo"] - -use std::ops::Deref; - -pub struct Foo; -pub struct Bar; - -impl Foo { - pub fn by_ref(&self) {} - pub fn by_explicit_ref(self: &Foo) {} - pub fn by_mut_ref(&mut self) {} - pub fn by_explicit_mut_ref(self: &mut Foo) {} - pub fn by_explicit_box(self: Box) {} - pub fn by_explicit_self_box(self: Box) {} - pub fn static_foo() {} -} - -impl Deref for Bar { - type Target = Foo; - fn deref(&self) -> &Foo { loop {} } -} - -// @has foo/struct.Bar.html -// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)' -// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' -// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)' -// @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' -// @!has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)' -// @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' -// @!has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' -// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/tests/rustdoc/issue-35488.rs b/tests/rustdoc/issue-35488.rs deleted file mode 100644 index ed955dcd770..00000000000 --- a/tests/rustdoc/issue-35488.rs +++ /dev/null @@ -1,16 +0,0 @@ -// https://github.com/rust-lang/rust/issues/35488 -#![crate_name="foo"] - -mod foo { - pub enum Foo { - Bar, - } - pub use self::Foo::*; -} - -// @has 'foo/index.html' '//code' 'pub use self::Foo::*;' -// @has 'foo/enum.Foo.html' -pub use self::foo::*; - -// @has 'foo/index.html' '//code' 'pub use std::option::Option::None;' -pub use std::option::Option::None; diff --git a/tests/rustdoc/issue-41783.codeblock.html b/tests/rustdoc/issue-41783.codeblock.html deleted file mode 100644 index 3bca4536cd5..00000000000 --- a/tests/rustdoc/issue-41783.codeblock.html +++ /dev/null @@ -1,5 +0,0 @@ -# single -## double -### triple -#[outer] -#![inner] diff --git a/tests/rustdoc/issue-41783.rs b/tests/rustdoc/issue-41783.rs deleted file mode 100644 index 7782e148fd9..00000000000 --- a/tests/rustdoc/issue-41783.rs +++ /dev/null @@ -1,22 +0,0 @@ -// https://github.com/rust-lang/rust/issues/41783 -#![crate_name="foo"] - -// @has foo/struct.Foo.html -// @!hasraw - 'space' -// @!hasraw - 'comment' -// @hasraw - '#[outer]' -// @!hasraw - '#[outer]' -// @hasraw - '#![inner]' -// @!hasraw - '#![inner]' -// @snapshot 'codeblock' - '//*[@class="toggle top-doc"]/*[@class="docblock"]//pre/code' - -/// ```no_run -/// # # space -/// # comment -/// ## single -/// ### double -/// #### triple -/// ##[outer] -/// ##![inner] -/// ``` -pub struct Foo; diff --git a/tests/rustdoc/issue-42760.rs b/tests/rustdoc/issue-42760.rs deleted file mode 100644 index 16c1705eb00..00000000000 --- a/tests/rustdoc/issue-42760.rs +++ /dev/null @@ -1,18 +0,0 @@ -// https://github.com/rust-lang/rust/issues/42760 -#![crate_name="foo"] - -#![allow(rustdoc::invalid_rust_codeblocks)] - -// @has foo/struct.NonGen.html -// @has - '//h2' 'Example' - -/// Item docs. -/// -#[doc="Hello there!"] -/// -/// # Example -/// -/// ```rust -/// // some code here -/// ``` -pub struct NonGen; diff --git a/tests/rustdoc/issue-43869.rs b/tests/rustdoc/issue-43869.rs deleted file mode 100644 index 9c4ed841f79..00000000000 --- a/tests/rustdoc/issue-43869.rs +++ /dev/null @@ -1,75 +0,0 @@ -// https://github.com/rust-lang/rust/issues/43869 -#![crate_name="foo"] - -pub fn g() -> impl Iterator { - Some(1u8).into_iter() -} - -#[allow(unused_parens)] -pub fn h() -> (impl Iterator) { - Some(1u8).into_iter() -} - -pub fn i() -> impl Iterator + 'static { - Some(1u8).into_iter() -} - -pub fn j() -> impl Iterator + Clone { - Some(1u8).into_iter() -} - -pub fn k() -> [impl Clone; 2] { - [123u32, 456u32] -} - -pub fn l() -> (impl Clone, impl Default) { - (789u32, -123i32) -} - -pub fn m() -> &'static impl Clone { - &1u8 -} - -pub fn n() -> *const impl Clone { - &1u8 -} - -pub fn o() -> &'static [impl Clone] { - b":)" -} - -// issue #44731 -pub fn test_44731_0() -> Box> { - Box::new(g()) -} - -pub fn test_44731_1() -> Result, ()> { - Ok(Box::new(j())) -} - -// NOTE these involve Fn sugar, where impl Trait is disallowed for now, see issue #45994 -// -//pub fn test_44731_2() -> Box { -// Box::new(|_: u32| {}) -//} -// -//pub fn test_44731_3() -> Box impl Clone> { -// Box::new(|| 0u32) -//} - -pub fn test_44731_4() -> Box> { - Box::new(g()) -} - -// @has foo/fn.g.html -// @has foo/fn.h.html -// @has foo/fn.i.html -// @has foo/fn.j.html -// @has foo/fn.k.html -// @has foo/fn.l.html -// @has foo/fn.m.html -// @has foo/fn.n.html -// @has foo/fn.o.html -// @has foo/fn.test_44731_0.html -// @has foo/fn.test_44731_1.html -// @has foo/fn.test_44731_4.html diff --git a/tests/rustdoc/issue-46377.rs b/tests/rustdoc/issue-46377.rs deleted file mode 100644 index aec74f493d4..00000000000 --- a/tests/rustdoc/issue-46377.rs +++ /dev/null @@ -1,6 +0,0 @@ -// https://github.com/rust-lang/rust/issues/46377 -#![crate_name="foo"] - -// @has 'foo/index.html' '//*[@class="desc docblock-short"]' 'Check out this struct!' -/// # Check out this struct! -pub struct SomeStruct; diff --git a/tests/rustdoc/issue-46380-2.rs b/tests/rustdoc/issue-46380-2.rs deleted file mode 100644 index 96ebd888eb5..00000000000 --- a/tests/rustdoc/issue-46380-2.rs +++ /dev/null @@ -1,12 +0,0 @@ -// https://github.com/rust-lang/rust/issues/46380 -#![crate_name="foo"] - -pub trait PublicTrait {} - -// @has foo/struct.PublicStruct.html -pub struct PublicStruct; - -// @!has - '//*[@class="impl"]' 'impl PublicTrait for PublicStruct' -impl PublicTrait for PublicStruct {} - -struct PrivateStruct; diff --git a/tests/rustdoc/issue-46727.rs b/tests/rustdoc/issue-46727.rs deleted file mode 100644 index d0ce9c34f51..00000000000 --- a/tests/rustdoc/issue-46727.rs +++ /dev/null @@ -1,10 +0,0 @@ -// https://github.com/rust-lang/rust/issues/46727 -#![crate_name="foo"] - -// aux-build:issue-46727.rs - -extern crate issue_46727; - -// @has foo/trait.Foo.html -// @has - '//h3[@class="code-header"]' 'impl Foo for Bar<[T; 3]>' -pub use issue_46727::{Foo, Bar}; diff --git a/tests/rustdoc/issue-47197-blank-line-in-doc-block.rs b/tests/rustdoc/issue-47197-blank-line-in-doc-block.rs deleted file mode 100644 index 79492b4fa76..00000000000 --- a/tests/rustdoc/issue-47197-blank-line-in-doc-block.rs +++ /dev/null @@ -1,11 +0,0 @@ -// https://github.com/rust-lang/rust/issues/47197 -#![crate_name="foo"] - -// @has foo/fn.whose_woods_these_are_i_think_i_know.html - -/** -* snow - -* ice -*/ -pub fn whose_woods_these_are_i_think_i_know() {} diff --git a/tests/rustdoc/issue-50159.rs b/tests/rustdoc/issue-50159.rs deleted file mode 100644 index 0663ed5fc81..00000000000 --- a/tests/rustdoc/issue-50159.rs +++ /dev/null @@ -1,23 +0,0 @@ -// https://github.com/rust-lang/rust/issues/50159 -#![crate_name="foo"] - -pub trait Signal { - type Item; -} - -pub trait Signal2 { - type Item2; -} - -impl Signal2 for B where B: Signal { - type Item2 = C; -} - -// @has foo/struct.Switch.html -// @has - '//h3[@class="code-header"]' 'impl Send for Switchwhere ::Item: Send' -// @has - '//h3[@class="code-header"]' 'impl Sync for Switchwhere ::Item: Sync' -// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0 -// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 5 -pub struct Switch { - pub inner: ::Item2, -} diff --git a/tests/rustdoc/issue-51236.rs b/tests/rustdoc/issue-51236.rs deleted file mode 100644 index 30c81e79601..00000000000 --- a/tests/rustdoc/issue-51236.rs +++ /dev/null @@ -1,17 +0,0 @@ -// https://github.com/rust-lang/rust/issues/51236 -#![crate_name="foo"] - -use std::marker::PhantomData; - -pub mod traits { - pub trait Owned<'a> { - type Reader; - } -} - -// @has foo/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl Send for Ownedwhere >::Reader: Send" -pub struct Owned where T: for<'a> ::traits::Owned<'a> { - marker: PhantomData<>::Reader>, -} diff --git a/tests/rustdoc/issue-52873.rs b/tests/rustdoc/issue-52873.rs deleted file mode 100644 index 12d3e3d7f94..00000000000 --- a/tests/rustdoc/issue-52873.rs +++ /dev/null @@ -1,174 +0,0 @@ -// https://github.com/rust-lang/rust/issues/52873 -#![crate_name="foo"] - -// Regression test for #52873. We used to ICE due to unexpected -// overflows when checking for "blanket impl inclusion". - -use std::marker::PhantomData; -use std::cmp::Ordering; -use std::ops::{Add, Mul}; - -pub type True = B1; -pub type False = B0; -pub type U0 = UTerm; -pub type U1 = UInt; - -pub trait NonZero {} - -pub trait Bit { -} - -pub trait Unsigned { -} - -#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)] -pub struct B0; - -impl B0 { - #[inline] - pub fn new() -> B0 { - B0 - } -} - -#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)] -pub struct B1; - -impl B1 { - #[inline] - pub fn new() -> B1 { - B1 - } -} - -impl Bit for B0 { -} - -impl Bit for B1 { -} - -impl NonZero for B1 {} - -pub trait PrivatePow { - type Output; -} -pub type PrivatePowOut = >::Output; - -pub type Add1 = >::Output; -pub type Prod = >::Output; -pub type Square = ::Output; -pub type Sum = >::Output; - -#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)] -pub struct UTerm; - -impl UTerm { - #[inline] - pub fn new() -> UTerm { - UTerm - } -} - -impl Unsigned for UTerm { -} - -#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)] -pub struct UInt { - _marker: PhantomData<(U, B)>, -} - -impl UInt { - #[inline] - pub fn new() -> UInt { - UInt { - _marker: PhantomData, - } - } -} - -impl Unsigned for UInt { -} - -impl NonZero for UInt {} - -impl Add for UTerm { - type Output = UTerm; - fn add(self, _: B0) -> Self::Output { - UTerm - } -} - -impl Add for UInt { - type Output = UInt; - fn add(self, _: B0) -> Self::Output { - UInt::new() - } -} - -impl Add for UTerm { - type Output = U; - fn add(self, _: U) -> Self::Output { - unimplemented!() - } -} - -impl Mul for UInt { - type Output = UTerm; - fn mul(self, _: B0) -> Self::Output { - UTerm - } -} - -impl Mul for UInt { - type Output = UInt; - fn mul(self, _: B1) -> Self::Output { - UInt::new() - } -} - -impl Mul for UTerm { - type Output = UTerm; - fn mul(self, _: U) -> Self::Output { - UTerm - } -} - -impl Mul> for UInt -where - Ul: Mul>, -{ - type Output = UInt>, B0>; - fn mul(self, _: UInt) -> Self::Output { - unimplemented!() - } -} - -pub trait Pow { - type Output; -} - -impl Pow for X -where - X: PrivatePow, -{ - type Output = PrivatePowOut; -} - -impl PrivatePow for X { - type Output = Y; -} - -impl PrivatePow for X -where - X: Mul, -{ - type Output = Prod; -} - -impl PrivatePow, B0>> for X -where - X: Mul, - Square: PrivatePow>, -{ - type Output = PrivatePowOut, Y, UInt>; -} diff --git a/tests/rustdoc/issue-53689.rs b/tests/rustdoc/issue-53689.rs deleted file mode 100644 index 7c2edd01a60..00000000000 --- a/tests/rustdoc/issue-53689.rs +++ /dev/null @@ -1,17 +0,0 @@ -// https://github.com/rust-lang/rust/issues/53689 -// aux-build:issue-53689.rs - -#![crate_name = "foo"] - -extern crate issue_53689; - -// @has foo/trait.MyTrait.html -// @!hasraw - 'MyStruct' -// @count - '//*[h3="impl MyTrait for T"]' 1 -pub trait MyTrait {} - -impl MyTrait for T {} - -mod a { - pub use issue_53689::MyStruct; -} diff --git a/tests/rustdoc/issue-53812.rs b/tests/rustdoc/issue-53812.rs deleted file mode 100644 index 968ae035043..00000000000 --- a/tests/rustdoc/issue-53812.rs +++ /dev/null @@ -1,23 +0,0 @@ -// https://github.com/rust-lang/rust/issues/53812 -#![crate_name="foo"] - -pub trait MyIterator {} - -pub struct MyStruct(T); - -macro_rules! array_impls { - ($($N:expr)+) => { - $( - impl<'a, T> MyIterator for &'a MyStruct<[T; $N]> { - } - )+ - } -} - -// @has foo/trait.MyIterator.html -// @has - '//*[@id="implementors-list"]/*[@class="impl"][1]' 'MyStruct<[T; 0]>' -// @has - '//*[@id="implementors-list"]/*[@class="impl"][2]' 'MyStruct<[T; 1]>' -// @has - '//*[@id="implementors-list"]/*[@class="impl"][3]' 'MyStruct<[T; 2]>' -// @has - '//*[@id="implementors-list"]/*[@class="impl"][4]' 'MyStruct<[T; 3]>' -// @has - '//*[@id="implementors-list"]/*[@class="impl"][5]' 'MyStruct<[T; 10]>' -array_impls! { 10 3 2 1 0 } diff --git a/tests/rustdoc/issue-54478-demo-allocator.rs b/tests/rustdoc/issue-54478-demo-allocator.rs deleted file mode 100644 index 39acee36d88..00000000000 --- a/tests/rustdoc/issue-54478-demo-allocator.rs +++ /dev/null @@ -1,45 +0,0 @@ -// https://github.com/rust-lang/rust/issues/54478 -#![crate_name="foo"] - -// Issue #54478: regression test showing that we can demonstrate -// `#[global_allocator]` in code blocks built by `rustdoc`. -// -// ## Background -// -// Changes in lang-item visibility injected failures that were only -// exposed when compiling with `-C prefer-dynamic`. But `rustdoc` used -// `-C prefer-dynamic` (and had done so for years, for reasons we did -// not document at that time). -// -// Rather than try to revise the visbility semanics, we instead -// decided to change `rustdoc` to behave more like the compiler's -// default setting, by leaving off `-C prefer-dynamic`. - -// compile-flags:--test - -//! This is a doc comment -//! -//! ```rust -//! use std::alloc::*; -//! -//! #[global_allocator] -//! static ALLOC: A = A; -//! -//! static mut HIT: bool = false; -//! -//! struct A; -//! -//! unsafe impl GlobalAlloc for A { -//! unsafe fn alloc(&self, layout: Layout) -> *mut u8 { -//! HIT = true; -//! System.alloc(layout) -//! } -//! unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { -//! System.dealloc(ptr, layout); -//! } -//! } -//! -//! fn main() { -//! assert!(unsafe { HIT }); -//! } -//! ``` diff --git a/tests/rustdoc/issue-54705.rs b/tests/rustdoc/issue-54705.rs deleted file mode 100644 index 00be0042fb0..00000000000 --- a/tests/rustdoc/issue-54705.rs +++ /dev/null @@ -1,30 +0,0 @@ -// https://github.com/rust-lang/rust/issues/54705 -#![crate_name="foo"] - -pub trait ScopeHandle<'scope> {} - -// @has foo/struct.ScopeFutureContents.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<'scope, S> Send for ScopeFutureContents<'scope, S>where S: Sync" -// -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<'scope, S> Sync for ScopeFutureContents<'scope, S>where S: Sync" -pub struct ScopeFutureContents<'scope, S> - where S: ScopeHandle<'scope>, -{ - dummy: &'scope S, - this: Box>, -} - -struct ScopeFuture<'scope, S> - where S: ScopeHandle<'scope>, -{ - contents: ScopeFutureContents<'scope, S>, -} - -unsafe impl<'scope, S> Send for ScopeFuture<'scope, S> - where S: ScopeHandle<'scope>, -{} -unsafe impl<'scope, S> Sync for ScopeFuture<'scope, S> - where S: ScopeHandle<'scope>, -{} diff --git a/tests/rustdoc/issue-55001.rs b/tests/rustdoc/issue-55001.rs deleted file mode 100644 index b7d86a1c843..00000000000 --- a/tests/rustdoc/issue-55001.rs +++ /dev/null @@ -1,34 +0,0 @@ -// https://github.com/rust-lang/rust/issues/55001 -#![crate_name="foo"] - -// Regression test for issue #55001. Previously, we would incorrectly -// cache certain trait selection results when checking for blanket impls, -// resulting in an ICE when we tried to confirm the cached ParamCandidate -// against an obligation. - -pub struct DefaultAllocator; -pub struct Standard; -pub struct Inner; - -pub trait Rand {} - -pub trait Distribution {} -pub trait Allocator {} - -impl Rand for T where Standard: Distribution {} - -impl Distribution> for Standard -where -DefaultAllocator: Allocator, -Standard: Distribution {} - -impl Distribution for Standard {} - - -pub struct Point -where DefaultAllocator: Allocator -{ - field: N -} - -fn main() {} diff --git a/tests/rustdoc/issue-55321.rs b/tests/rustdoc/issue-55321.rs deleted file mode 100644 index e9be1ff854e..00000000000 --- a/tests/rustdoc/issue-55321.rs +++ /dev/null @@ -1,21 +0,0 @@ -// https://github.com/rust-lang/rust/issues/55321 -#![crate_name="foo"] - -#![feature(negative_impls)] - -// @has foo/struct.A.html -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl !Send for A" -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl !Sync for A" -pub struct A(); - -impl !Send for A {} -impl !Sync for A {} - -// @has foo/struct.B.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl !Send for B" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl !Sync for B" -pub struct B(A, Box); diff --git a/tests/rustdoc/issue-55364.rs b/tests/rustdoc/issue-55364.rs deleted file mode 100644 index c07aba628c9..00000000000 --- a/tests/rustdoc/issue-55364.rs +++ /dev/null @@ -1,89 +0,0 @@ -// https://github.com/rust-lang/rust/issues/55364 -#![crate_name="foo"] - -// First a module with inner documentation - -// @has foo/subone/index.html -// These foo/bar links in the module's documentation should refer inside `subone` -// @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' -// @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' -pub mod subone { - //! See either [foo] or [bar]. - - // This should refer to subone's `bar` - // @has foo/subone/fn.foo.html - // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' - /// See [bar] - pub fn foo() {} - // This should refer to subone's `foo` - // @has foo/subone/fn.bar.html - // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' - /// See [foo] - pub fn bar() {} -} - -// A module with outer documentation - -// @has foo/subtwo/index.html -// These foo/bar links in the module's documentation should not reference inside `subtwo` -// @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' -// @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' -// Instead it should be referencing the top level functions -// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' -// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' -// Though there should be such links later -// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.foo.html"]' 'foo' -// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.bar.html"]' 'bar' -/// See either [foo] or [bar]. -pub mod subtwo { - - // Despite the module's docs referring to the top level foo/bar, - // this should refer to subtwo's `bar` - // @has foo/subtwo/fn.foo.html - // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar' - /// See [bar] - pub fn foo() {} - // Despite the module's docs referring to the top level foo/bar, - // this should refer to subtwo's `foo` - // @has foo/subtwo/fn.bar.html - // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo' - /// See [foo] - pub fn bar() {} -} - -// These are the function referred to by the module above with outer docs - -/// See [bar] -pub fn foo() {} -/// See [foo] -pub fn bar() {} - -// This module refers to the outer foo/bar by means of `super::` - -// @has foo/subthree/index.html -// This module should also refer to the top level foo/bar -// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' -// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' -pub mod subthree { - //! See either [foo][super::foo] or [bar][super::bar] -} - -// Next we go *deeper* - In order to ensure it's not just "this or parent" -// we test `crate::` and a `super::super::...` chain -// @has foo/subfour/subfive/subsix/subseven/subeight/index.html -// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo' -// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar' -pub mod subfour { - pub mod subfive { - pub mod subsix { - pub mod subseven { - pub mod subeight { - /// See [other foo][crate::subone::foo] - pub fn foo() {} - /// See [other bar][super::super::super::super::super::subtwo::bar] - pub fn bar() {} - } - } - } - } -} diff --git a/tests/rustdoc/public-impl-mention-private-generic-46380-2.rs b/tests/rustdoc/public-impl-mention-private-generic-46380-2.rs new file mode 100644 index 00000000000..96ebd888eb5 --- /dev/null +++ b/tests/rustdoc/public-impl-mention-private-generic-46380-2.rs @@ -0,0 +1,12 @@ +// https://github.com/rust-lang/rust/issues/46380 +#![crate_name="foo"] + +pub trait PublicTrait {} + +// @has foo/struct.PublicStruct.html +pub struct PublicStruct; + +// @!has - '//*[@class="impl"]' 'impl PublicTrait for PublicStruct' +impl PublicTrait for PublicStruct {} + +struct PrivateStruct; diff --git a/tests/rustdoc/sort-53812.rs b/tests/rustdoc/sort-53812.rs new file mode 100644 index 00000000000..968ae035043 --- /dev/null +++ b/tests/rustdoc/sort-53812.rs @@ -0,0 +1,23 @@ +// https://github.com/rust-lang/rust/issues/53812 +#![crate_name="foo"] + +pub trait MyIterator {} + +pub struct MyStruct(T); + +macro_rules! array_impls { + ($($N:expr)+) => { + $( + impl<'a, T> MyIterator for &'a MyStruct<[T; $N]> { + } + )+ + } +} + +// @has foo/trait.MyIterator.html +// @has - '//*[@id="implementors-list"]/*[@class="impl"][1]' 'MyStruct<[T; 0]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][2]' 'MyStruct<[T; 1]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][3]' 'MyStruct<[T; 2]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][4]' 'MyStruct<[T; 3]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][5]' 'MyStruct<[T; 10]>' +array_impls! { 10 3 2 1 0 } diff --git a/tests/rustdoc/summary-header-46377.rs b/tests/rustdoc/summary-header-46377.rs new file mode 100644 index 00000000000..aec74f493d4 --- /dev/null +++ b/tests/rustdoc/summary-header-46377.rs @@ -0,0 +1,6 @@ +// https://github.com/rust-lang/rust/issues/46377 +#![crate_name="foo"] + +// @has 'foo/index.html' '//*[@class="desc docblock-short"]' 'Check out this struct!' +/// # Check out this struct! +pub struct SomeStruct; -- cgit 1.4.1-3-g733a5 From a704e21c3f2ee1c9215bd088d2880c8e396eacca Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 3 Jan 2024 15:30:46 -0700 Subject: Add `check-pass` to ice tests --- tests/rustdoc-ui/ice-blanket-impl-52873.rs | 1 + tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/rustdoc-ui/ice-blanket-impl-52873.rs b/tests/rustdoc-ui/ice-blanket-impl-52873.rs index 12d3e3d7f94..2520957bd00 100644 --- a/tests/rustdoc-ui/ice-blanket-impl-52873.rs +++ b/tests/rustdoc-ui/ice-blanket-impl-52873.rs @@ -1,3 +1,4 @@ +// check-pass // https://github.com/rust-lang/rust/issues/52873 #![crate_name="foo"] diff --git a/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs b/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs index b7d86a1c843..babcb3dda14 100644 --- a/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs +++ b/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs @@ -1,3 +1,4 @@ +// check-pass // https://github.com/rust-lang/rust/issues/55001 #![crate_name="foo"] -- cgit 1.4.1-3-g733a5