From 0f466b06d197729ebeeb72a9503f0a878749ec87 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 20 Nov 2023 11:50:18 -0700 Subject: rustdoc: rename `issue-\d+.rs` tests to have meaningful names --- tests/rustdoc/doctest-crate-attributes-38129.rs | 99 ++++++++++++++++++++++ tests/rustdoc/doctest-include-43153.rs | 10 +++ tests/rustdoc/doctest-macro-38219.rs | 8 ++ .../doctest-markdown-trailing-docblock-48377.rs | 13 +++ tests/rustdoc/enum-variant-private-46767.rs | 9 ++ tests/rustdoc/enum-variant-reexport-46766.rs | 6 ++ tests/rustdoc/foreign-implementors-js-43701.rs | 5 ++ tests/rustdoc/ice-34423.rs | 10 +++ tests/rustdoc/ice-36031.rs | 9 ++ tests/rustdoc/ice-apit-46976.rs | 1 + tests/rustdoc/ice-circular-intra-doc-link-48414.rs | 11 +++ tests/rustdoc/ice-extern-crate-40936.rs | 6 ++ tests/rustdoc/ice-nested-extern-crate-46271.rs | 5 ++ tests/rustdoc/ice-nested-macro-rules-47639.rs | 6 ++ tests/rustdoc/inline-rename-34473.rs | 11 +++ tests/rustdoc/issue-34423.rs | 10 --- tests/rustdoc/issue-34473.rs | 11 --- tests/rustdoc/issue-34928.rs | 6 -- tests/rustdoc/issue-36031.rs | 9 -- tests/rustdoc/issue-38129.rs | 99 ---------------------- tests/rustdoc/issue-38219.rs | 8 -- tests/rustdoc/issue-40936.rs | 6 -- tests/rustdoc/issue-43153.rs | 10 --- tests/rustdoc/issue-43701.rs | 5 -- tests/rustdoc/issue-43893.rs | 19 ----- tests/rustdoc/issue-45584.rs | 15 ---- tests/rustdoc/issue-46271.rs | 5 -- .../issue-46506-pub-reexport-of-pub-reexport.rs | 24 ------ tests/rustdoc/issue-46766.rs | 6 -- tests/rustdoc/issue-46767.rs | 9 -- tests/rustdoc/issue-46976.rs | 1 - tests/rustdoc/issue-47038.rs | 10 --- tests/rustdoc/issue-47639.rs | 6 -- tests/rustdoc/issue-48377.rs | 13 --- tests/rustdoc/issue-48414.rs | 11 --- tests/rustdoc/private-use-decl-macro-47038.rs | 10 +++ .../rustdoc/pub-reexport-of-pub-reexport-46506.rs | 24 ++++++ tests/rustdoc/src-links-implementor-43893.rs | 19 +++++ .../trait-implementations-duplicate-self-45584.rs | 15 ++++ tests/rustdoc/tuple-struct-34928.rs | 6 ++ 40 files changed, 283 insertions(+), 283 deletions(-) create mode 100644 tests/rustdoc/doctest-crate-attributes-38129.rs create mode 100644 tests/rustdoc/doctest-include-43153.rs create mode 100644 tests/rustdoc/doctest-macro-38219.rs create mode 100644 tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs create mode 100644 tests/rustdoc/enum-variant-private-46767.rs create mode 100644 tests/rustdoc/enum-variant-reexport-46766.rs create mode 100644 tests/rustdoc/foreign-implementors-js-43701.rs create mode 100644 tests/rustdoc/ice-34423.rs create mode 100644 tests/rustdoc/ice-36031.rs create mode 100644 tests/rustdoc/ice-apit-46976.rs create mode 100644 tests/rustdoc/ice-circular-intra-doc-link-48414.rs create mode 100644 tests/rustdoc/ice-extern-crate-40936.rs create mode 100644 tests/rustdoc/ice-nested-extern-crate-46271.rs create mode 100644 tests/rustdoc/ice-nested-macro-rules-47639.rs create mode 100644 tests/rustdoc/inline-rename-34473.rs delete mode 100644 tests/rustdoc/issue-34423.rs delete mode 100644 tests/rustdoc/issue-34473.rs delete mode 100644 tests/rustdoc/issue-34928.rs delete mode 100644 tests/rustdoc/issue-36031.rs delete mode 100644 tests/rustdoc/issue-38129.rs delete mode 100644 tests/rustdoc/issue-38219.rs delete mode 100644 tests/rustdoc/issue-40936.rs delete mode 100644 tests/rustdoc/issue-43153.rs delete mode 100644 tests/rustdoc/issue-43701.rs delete mode 100644 tests/rustdoc/issue-43893.rs delete mode 100644 tests/rustdoc/issue-45584.rs delete mode 100644 tests/rustdoc/issue-46271.rs delete mode 100644 tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs delete mode 100644 tests/rustdoc/issue-46766.rs delete mode 100644 tests/rustdoc/issue-46767.rs delete mode 100644 tests/rustdoc/issue-46976.rs delete mode 100644 tests/rustdoc/issue-47038.rs delete mode 100644 tests/rustdoc/issue-47639.rs delete mode 100644 tests/rustdoc/issue-48377.rs delete mode 100644 tests/rustdoc/issue-48414.rs create mode 100644 tests/rustdoc/private-use-decl-macro-47038.rs create mode 100644 tests/rustdoc/pub-reexport-of-pub-reexport-46506.rs create mode 100644 tests/rustdoc/src-links-implementor-43893.rs create mode 100644 tests/rustdoc/trait-implementations-duplicate-self-45584.rs create mode 100644 tests/rustdoc/tuple-struct-34928.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/doctest-crate-attributes-38129.rs b/tests/rustdoc/doctest-crate-attributes-38129.rs new file mode 100644 index 00000000000..156d50fa52a --- /dev/null +++ b/tests/rustdoc/doctest-crate-attributes-38129.rs @@ -0,0 +1,99 @@ +// compile-flags:--test + +// This file tests the source-partitioning behavior of rustdoc. +// Each test contains some code that should be put into the generated +// `fn main` and some attributes should be left outside (except the first +// one, which has no attributes). +// If the #![recursion_limit] attribute is incorrectly left inside, +// then the tests will fail because the macro recurses 128 times. + +/// ``` +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn simple() {} + +/// ``` +/// #![recursion_limit = "1024"] +/// macro_rules! recurse { +/// (()) => {}; +/// (() $($rest:tt)*) => { recurse!($($rest)*); } +/// } +/// recurse!(() () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () ()); +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn non_feature_attr() {} + +/// ``` +/// #![feature(core_intrinsics)] +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn feature_attr() {} + +/// ``` +/// #![feature(core_intrinsics)] +/// #![recursion_limit = "1024"] +/// macro_rules! recurse { +/// (()) => {}; +/// (() $($rest:tt)*) => { recurse!($($rest)*); } +/// } +/// recurse!(() () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () ()); +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn both_attrs() {} + +/// ``` +/// #![recursion_limit = "1024"] +/// #![feature(core_intrinsics)] +/// macro_rules! recurse { +/// (()) => {}; +/// (() $($rest:tt)*) => { recurse!($($rest)*); } +/// } +/// recurse!(() () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () ()); +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn both_attrs_reverse() {} diff --git a/tests/rustdoc/doctest-include-43153.rs b/tests/rustdoc/doctest-include-43153.rs new file mode 100644 index 00000000000..0fe680f10af --- /dev/null +++ b/tests/rustdoc/doctest-include-43153.rs @@ -0,0 +1,10 @@ +// Test that `include!` in a doc test searches relative to the directory in +// which the test is declared. + +// compile-flags:--test + +/// ```rust +/// include!("auxiliary/empty.rs"); +/// fn main() {} +/// ``` +pub struct Foo; diff --git a/tests/rustdoc/doctest-macro-38219.rs b/tests/rustdoc/doctest-macro-38219.rs new file mode 100644 index 00000000000..fa57c58c761 --- /dev/null +++ b/tests/rustdoc/doctest-macro-38219.rs @@ -0,0 +1,8 @@ +// compile-flags:--test +// should-fail + +/// ``` +/// fail +/// ``` +#[macro_export] +macro_rules! foo { () => {} } diff --git a/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs b/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs new file mode 100644 index 00000000000..c32bcf380ea --- /dev/null +++ b/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs @@ -0,0 +1,13 @@ +// compile-flags:--test + +//! This is a doc comment +//! +//! ```rust +//! fn main() {} +//! ``` +//! +//! With a trailing code fence +//! ``` + +/// Some foo function +pub fn foo() {} diff --git a/tests/rustdoc/enum-variant-private-46767.rs b/tests/rustdoc/enum-variant-private-46767.rs new file mode 100644 index 00000000000..ef6ed104b74 --- /dev/null +++ b/tests/rustdoc/enum-variant-private-46767.rs @@ -0,0 +1,9 @@ +#![crate_name = "foo"] + +mod private { + pub enum Enum{Variant} +} +pub use self::private::Enum::*; + +// @!has-dir foo/private +// @!has foo/index.html '//a/@href' 'private/index.html' diff --git a/tests/rustdoc/enum-variant-reexport-46766.rs b/tests/rustdoc/enum-variant-reexport-46766.rs new file mode 100644 index 00000000000..36ab739565b --- /dev/null +++ b/tests/rustdoc/enum-variant-reexport-46766.rs @@ -0,0 +1,6 @@ +#![crate_name = "foo"] + +pub enum Enum{Variant} +pub use self::Enum::Variant; + +// @!has foo/index.html '//a/@href' './Enum/index.html' diff --git a/tests/rustdoc/foreign-implementors-js-43701.rs b/tests/rustdoc/foreign-implementors-js-43701.rs new file mode 100644 index 00000000000..de772881e73 --- /dev/null +++ b/tests/rustdoc/foreign-implementors-js-43701.rs @@ -0,0 +1,5 @@ +#![crate_name = "foo"] + +pub use std::vec::Vec; + +// @!has trait.impl/core/clone/trait.Clone.js diff --git a/tests/rustdoc/ice-34423.rs b/tests/rustdoc/ice-34423.rs new file mode 100644 index 00000000000..b429bf8c9ba --- /dev/null +++ b/tests/rustdoc/ice-34423.rs @@ -0,0 +1,10 @@ +pub struct Foo; + +pub trait Bar { + #[doc(hidden)] + fn bar() {} +} + +impl Bar for Foo { + fn bar() {} +} diff --git a/tests/rustdoc/ice-36031.rs b/tests/rustdoc/ice-36031.rs new file mode 100644 index 00000000000..af1b32fd22b --- /dev/null +++ b/tests/rustdoc/ice-36031.rs @@ -0,0 +1,9 @@ +// aux-build:issue-36031.rs +// build-aux-docs +// ignore-cross-compile + +#![crate_name = "foo"] + +extern crate issue_36031; + +pub use issue_36031::Foo; diff --git a/tests/rustdoc/ice-apit-46976.rs b/tests/rustdoc/ice-apit-46976.rs new file mode 100644 index 00000000000..c59f8c72e64 --- /dev/null +++ b/tests/rustdoc/ice-apit-46976.rs @@ -0,0 +1 @@ +pub fn ice(f: impl Fn()) {} diff --git a/tests/rustdoc/ice-circular-intra-doc-link-48414.rs b/tests/rustdoc/ice-circular-intra-doc-link-48414.rs new file mode 100644 index 00000000000..b35743d887b --- /dev/null +++ b/tests/rustdoc/ice-circular-intra-doc-link-48414.rs @@ -0,0 +1,11 @@ +// aux-build:issue-48414.rs + +// ICE when resolving paths for a trait that linked to another trait, when both were in an external +// crate + +#![crate_name = "base"] + +extern crate issue_48414; + +#[doc(inline)] +pub use issue_48414::{SomeTrait, OtherTrait}; diff --git a/tests/rustdoc/ice-extern-crate-40936.rs b/tests/rustdoc/ice-extern-crate-40936.rs new file mode 100644 index 00000000000..4d2e4c17b1f --- /dev/null +++ b/tests/rustdoc/ice-extern-crate-40936.rs @@ -0,0 +1,6 @@ +// aux-build:issue-40936.rs +// build-aux-docs + +#![crate_name = "foo"] + +extern crate issue_40936; diff --git a/tests/rustdoc/ice-nested-extern-crate-46271.rs b/tests/rustdoc/ice-nested-extern-crate-46271.rs new file mode 100644 index 00000000000..b38ef20c551 --- /dev/null +++ b/tests/rustdoc/ice-nested-extern-crate-46271.rs @@ -0,0 +1,5 @@ +// hopefully this doesn't cause an ICE + +pub fn foo() { + extern crate std; +} diff --git a/tests/rustdoc/ice-nested-macro-rules-47639.rs b/tests/rustdoc/ice-nested-macro-rules-47639.rs new file mode 100644 index 00000000000..4b3456b86c5 --- /dev/null +++ b/tests/rustdoc/ice-nested-macro-rules-47639.rs @@ -0,0 +1,6 @@ +// This should not ICE +pub fn test() { + macro_rules! foo { + () => () + } +} diff --git a/tests/rustdoc/inline-rename-34473.rs b/tests/rustdoc/inline-rename-34473.rs new file mode 100644 index 00000000000..37da3dd1999 --- /dev/null +++ b/tests/rustdoc/inline-rename-34473.rs @@ -0,0 +1,11 @@ +#![crate_name = "foo"] + +mod second { + pub struct SomeTypeWithLongName; +} + +// @has foo/index.html +// @!hasraw - SomeTypeWithLongName +// @has foo/struct.SomeType.html +// @!has foo/struct.SomeTypeWithLongName.html +pub use second::{SomeTypeWithLongName as SomeType}; diff --git a/tests/rustdoc/issue-34423.rs b/tests/rustdoc/issue-34423.rs deleted file mode 100644 index b429bf8c9ba..00000000000 --- a/tests/rustdoc/issue-34423.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub struct Foo; - -pub trait Bar { - #[doc(hidden)] - fn bar() {} -} - -impl Bar for Foo { - fn bar() {} -} diff --git a/tests/rustdoc/issue-34473.rs b/tests/rustdoc/issue-34473.rs deleted file mode 100644 index 37da3dd1999..00000000000 --- a/tests/rustdoc/issue-34473.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_name = "foo"] - -mod second { - pub struct SomeTypeWithLongName; -} - -// @has foo/index.html -// @!hasraw - SomeTypeWithLongName -// @has foo/struct.SomeType.html -// @!has foo/struct.SomeTypeWithLongName.html -pub use second::{SomeTypeWithLongName as SomeType}; diff --git a/tests/rustdoc/issue-34928.rs b/tests/rustdoc/issue-34928.rs deleted file mode 100644 index 4184086f622..00000000000 --- a/tests/rustdoc/issue-34928.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name = "foo"] - -pub trait Bar {} - -// @has foo/struct.Foo.html '//pre' 'pub struct Foo(pub T) where T: Bar;' -pub struct Foo(pub T) where T: Bar; diff --git a/tests/rustdoc/issue-36031.rs b/tests/rustdoc/issue-36031.rs deleted file mode 100644 index af1b32fd22b..00000000000 --- a/tests/rustdoc/issue-36031.rs +++ /dev/null @@ -1,9 +0,0 @@ -// aux-build:issue-36031.rs -// build-aux-docs -// ignore-cross-compile - -#![crate_name = "foo"] - -extern crate issue_36031; - -pub use issue_36031::Foo; diff --git a/tests/rustdoc/issue-38129.rs b/tests/rustdoc/issue-38129.rs deleted file mode 100644 index 156d50fa52a..00000000000 --- a/tests/rustdoc/issue-38129.rs +++ /dev/null @@ -1,99 +0,0 @@ -// compile-flags:--test - -// This file tests the source-partitioning behavior of rustdoc. -// Each test contains some code that should be put into the generated -// `fn main` and some attributes should be left outside (except the first -// one, which has no attributes). -// If the #![recursion_limit] attribute is incorrectly left inside, -// then the tests will fail because the macro recurses 128 times. - -/// ``` -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn simple() {} - -/// ``` -/// #![recursion_limit = "1024"] -/// macro_rules! recurse { -/// (()) => {}; -/// (() $($rest:tt)*) => { recurse!($($rest)*); } -/// } -/// recurse!(() () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () ()); -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn non_feature_attr() {} - -/// ``` -/// #![feature(core_intrinsics)] -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn feature_attr() {} - -/// ``` -/// #![feature(core_intrinsics)] -/// #![recursion_limit = "1024"] -/// macro_rules! recurse { -/// (()) => {}; -/// (() $($rest:tt)*) => { recurse!($($rest)*); } -/// } -/// recurse!(() () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () ()); -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn both_attrs() {} - -/// ``` -/// #![recursion_limit = "1024"] -/// #![feature(core_intrinsics)] -/// macro_rules! recurse { -/// (()) => {}; -/// (() $($rest:tt)*) => { recurse!($($rest)*); } -/// } -/// recurse!(() () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () ()); -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn both_attrs_reverse() {} diff --git a/tests/rustdoc/issue-38219.rs b/tests/rustdoc/issue-38219.rs deleted file mode 100644 index fa57c58c761..00000000000 --- a/tests/rustdoc/issue-38219.rs +++ /dev/null @@ -1,8 +0,0 @@ -// compile-flags:--test -// should-fail - -/// ``` -/// fail -/// ``` -#[macro_export] -macro_rules! foo { () => {} } diff --git a/tests/rustdoc/issue-40936.rs b/tests/rustdoc/issue-40936.rs deleted file mode 100644 index 4d2e4c17b1f..00000000000 --- a/tests/rustdoc/issue-40936.rs +++ /dev/null @@ -1,6 +0,0 @@ -// aux-build:issue-40936.rs -// build-aux-docs - -#![crate_name = "foo"] - -extern crate issue_40936; diff --git a/tests/rustdoc/issue-43153.rs b/tests/rustdoc/issue-43153.rs deleted file mode 100644 index 0fe680f10af..00000000000 --- a/tests/rustdoc/issue-43153.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Test that `include!` in a doc test searches relative to the directory in -// which the test is declared. - -// compile-flags:--test - -/// ```rust -/// include!("auxiliary/empty.rs"); -/// fn main() {} -/// ``` -pub struct Foo; diff --git a/tests/rustdoc/issue-43701.rs b/tests/rustdoc/issue-43701.rs deleted file mode 100644 index de772881e73..00000000000 --- a/tests/rustdoc/issue-43701.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_name = "foo"] - -pub use std::vec::Vec; - -// @!has trait.impl/core/clone/trait.Clone.js diff --git a/tests/rustdoc/issue-43893.rs b/tests/rustdoc/issue-43893.rs deleted file mode 100644 index 95d55193459..00000000000 --- a/tests/rustdoc/issue-43893.rs +++ /dev/null @@ -1,19 +0,0 @@ -// ignore-cross-compile - -#![crate_name = "foo"] - -pub trait SomeTrait {} -pub struct SomeStruct; - -// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#9' -impl SomeTrait for usize {} - -// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#12-14' -impl SomeTrait for SomeStruct { - // deliberately multi-line impl -} - -pub trait AnotherTrait {} - -// @has foo/trait.AnotherTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#19' -impl AnotherTrait for T {} diff --git a/tests/rustdoc/issue-45584.rs b/tests/rustdoc/issue-45584.rs deleted file mode 100644 index 8a5f0413826..00000000000 --- a/tests/rustdoc/issue-45584.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_name = "foo"] - -pub trait Bar {} - -// @has 'foo/struct.Foo1.html' -pub struct Foo1; -// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 -// @has - '//*[@class="impl"]' "impl Bar for Foo1" -impl Bar for Foo1 {} - -// @has 'foo/struct.Foo2.html' -pub struct Foo2; -// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 -// @has - '//*[@class="impl"]' "impl Bar<&'static Foo2, Foo2> for u8" -impl Bar<&'static Foo2, Foo2> for u8 {} diff --git a/tests/rustdoc/issue-46271.rs b/tests/rustdoc/issue-46271.rs deleted file mode 100644 index b38ef20c551..00000000000 --- a/tests/rustdoc/issue-46271.rs +++ /dev/null @@ -1,5 +0,0 @@ -// hopefully this doesn't cause an ICE - -pub fn foo() { - extern crate std; -} diff --git a/tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs b/tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs deleted file mode 100644 index d8953eaf597..00000000000 --- a/tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs +++ /dev/null @@ -1,24 +0,0 @@ -// This is a regression test for . -// This test ensures that if public re-exported is re-exported, it won't be inlined. - -#![crate_name = "foo"] - -// @has 'foo/associations/index.html' -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Traits' -// @has - '//*[@id="main-content"]//a[@href="trait.GroupedBy.html"]' 'GroupedBy' -// @has 'foo/associations/trait.GroupedBy.html' -pub mod associations { - mod belongs_to { - pub trait GroupedBy {} - } - pub use self::belongs_to::GroupedBy; -} - -// @has 'foo/prelude/index.html' -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Re-exports' -// @has - '//*[@id="main-content"]//*[@id="reexport.GroupedBy"]' 'pub use associations::GroupedBy;' -pub mod prelude { - pub use associations::GroupedBy; -} diff --git a/tests/rustdoc/issue-46766.rs b/tests/rustdoc/issue-46766.rs deleted file mode 100644 index 36ab739565b..00000000000 --- a/tests/rustdoc/issue-46766.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name = "foo"] - -pub enum Enum{Variant} -pub use self::Enum::Variant; - -// @!has foo/index.html '//a/@href' './Enum/index.html' diff --git a/tests/rustdoc/issue-46767.rs b/tests/rustdoc/issue-46767.rs deleted file mode 100644 index ef6ed104b74..00000000000 --- a/tests/rustdoc/issue-46767.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_name = "foo"] - -mod private { - pub enum Enum{Variant} -} -pub use self::private::Enum::*; - -// @!has-dir foo/private -// @!has foo/index.html '//a/@href' 'private/index.html' diff --git a/tests/rustdoc/issue-46976.rs b/tests/rustdoc/issue-46976.rs deleted file mode 100644 index c59f8c72e64..00000000000 --- a/tests/rustdoc/issue-46976.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn ice(f: impl Fn()) {} diff --git a/tests/rustdoc/issue-47038.rs b/tests/rustdoc/issue-47038.rs deleted file mode 100644 index 810ddca3eab..00000000000 --- a/tests/rustdoc/issue-47038.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![feature(decl_macro)] - -#![crate_name = "foo"] - -use std::vec; - -// @has 'foo/index.html' -// @!has - '//*[@id="macros"]' 'Macros' -// @!has - '//a/@href' 'macro.vec.html' -// @!has 'foo/macro.vec.html' diff --git a/tests/rustdoc/issue-47639.rs b/tests/rustdoc/issue-47639.rs deleted file mode 100644 index 4b3456b86c5..00000000000 --- a/tests/rustdoc/issue-47639.rs +++ /dev/null @@ -1,6 +0,0 @@ -// This should not ICE -pub fn test() { - macro_rules! foo { - () => () - } -} diff --git a/tests/rustdoc/issue-48377.rs b/tests/rustdoc/issue-48377.rs deleted file mode 100644 index c32bcf380ea..00000000000 --- a/tests/rustdoc/issue-48377.rs +++ /dev/null @@ -1,13 +0,0 @@ -// compile-flags:--test - -//! This is a doc comment -//! -//! ```rust -//! fn main() {} -//! ``` -//! -//! With a trailing code fence -//! ``` - -/// Some foo function -pub fn foo() {} diff --git a/tests/rustdoc/issue-48414.rs b/tests/rustdoc/issue-48414.rs deleted file mode 100644 index b35743d887b..00000000000 --- a/tests/rustdoc/issue-48414.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:issue-48414.rs - -// ICE when resolving paths for a trait that linked to another trait, when both were in an external -// crate - -#![crate_name = "base"] - -extern crate issue_48414; - -#[doc(inline)] -pub use issue_48414::{SomeTrait, OtherTrait}; diff --git a/tests/rustdoc/private-use-decl-macro-47038.rs b/tests/rustdoc/private-use-decl-macro-47038.rs new file mode 100644 index 00000000000..810ddca3eab --- /dev/null +++ b/tests/rustdoc/private-use-decl-macro-47038.rs @@ -0,0 +1,10 @@ +#![feature(decl_macro)] + +#![crate_name = "foo"] + +use std::vec; + +// @has 'foo/index.html' +// @!has - '//*[@id="macros"]' 'Macros' +// @!has - '//a/@href' 'macro.vec.html' +// @!has 'foo/macro.vec.html' diff --git a/tests/rustdoc/pub-reexport-of-pub-reexport-46506.rs b/tests/rustdoc/pub-reexport-of-pub-reexport-46506.rs new file mode 100644 index 00000000000..d8953eaf597 --- /dev/null +++ b/tests/rustdoc/pub-reexport-of-pub-reexport-46506.rs @@ -0,0 +1,24 @@ +// This is a regression test for . +// This test ensures that if public re-exported is re-exported, it won't be inlined. + +#![crate_name = "foo"] + +// @has 'foo/associations/index.html' +// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 +// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Traits' +// @has - '//*[@id="main-content"]//a[@href="trait.GroupedBy.html"]' 'GroupedBy' +// @has 'foo/associations/trait.GroupedBy.html' +pub mod associations { + mod belongs_to { + pub trait GroupedBy {} + } + pub use self::belongs_to::GroupedBy; +} + +// @has 'foo/prelude/index.html' +// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 +// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Re-exports' +// @has - '//*[@id="main-content"]//*[@id="reexport.GroupedBy"]' 'pub use associations::GroupedBy;' +pub mod prelude { + pub use associations::GroupedBy; +} diff --git a/tests/rustdoc/src-links-implementor-43893.rs b/tests/rustdoc/src-links-implementor-43893.rs new file mode 100644 index 00000000000..95d55193459 --- /dev/null +++ b/tests/rustdoc/src-links-implementor-43893.rs @@ -0,0 +1,19 @@ +// ignore-cross-compile + +#![crate_name = "foo"] + +pub trait SomeTrait {} +pub struct SomeStruct; + +// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#9' +impl SomeTrait for usize {} + +// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#12-14' +impl SomeTrait for SomeStruct { + // deliberately multi-line impl +} + +pub trait AnotherTrait {} + +// @has foo/trait.AnotherTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#19' +impl AnotherTrait for T {} diff --git a/tests/rustdoc/trait-implementations-duplicate-self-45584.rs b/tests/rustdoc/trait-implementations-duplicate-self-45584.rs new file mode 100644 index 00000000000..8a5f0413826 --- /dev/null +++ b/tests/rustdoc/trait-implementations-duplicate-self-45584.rs @@ -0,0 +1,15 @@ +#![crate_name = "foo"] + +pub trait Bar {} + +// @has 'foo/struct.Foo1.html' +pub struct Foo1; +// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 +// @has - '//*[@class="impl"]' "impl Bar for Foo1" +impl Bar for Foo1 {} + +// @has 'foo/struct.Foo2.html' +pub struct Foo2; +// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 +// @has - '//*[@class="impl"]' "impl Bar<&'static Foo2, Foo2> for u8" +impl Bar<&'static Foo2, Foo2> for u8 {} diff --git a/tests/rustdoc/tuple-struct-34928.rs b/tests/rustdoc/tuple-struct-34928.rs new file mode 100644 index 00000000000..4184086f622 --- /dev/null +++ b/tests/rustdoc/tuple-struct-34928.rs @@ -0,0 +1,6 @@ +#![crate_name = "foo"] + +pub trait Bar {} + +// @has foo/struct.Foo.html '//pre' 'pub struct Foo(pub T) where T: Bar;' +pub struct Foo(pub T) where T: Bar; -- cgit 1.4.1-3-g733a5 From da7e87ef7042563f89204b4b2b4bb343e18696c5 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 20 Nov 2023 11:50:25 -0700 Subject: Add URL to test cases --- tests/rustdoc/doctest-include-43153.rs | 2 ++ tests/rustdoc/doctest-macro-38219.rs | 2 ++ tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs | 2 ++ tests/rustdoc/enum-variant-private-46767.rs | 1 + tests/rustdoc/enum-variant-reexport-46766.rs | 1 + tests/rustdoc/foreign-implementors-js-43701.rs | 1 + tests/rustdoc/ice-34423.rs | 2 ++ tests/rustdoc/ice-36031.rs | 2 ++ tests/rustdoc/ice-apit-46976.rs | 2 ++ tests/rustdoc/ice-circular-intra-doc-link-48414.rs | 2 ++ tests/rustdoc/ice-extern-crate-40936.rs | 2 ++ tests/rustdoc/ice-nested-extern-crate-46271.rs | 2 ++ tests/rustdoc/ice-nested-macro-rules-47639.rs | 2 ++ tests/rustdoc/inline-rename-34473.rs | 2 ++ tests/rustdoc/private-use-decl-macro-47038.rs | 2 ++ tests/rustdoc/src-links-implementor-43893.rs | 2 ++ tests/rustdoc/trait-implementations-duplicate-self-45584.rs | 2 ++ tests/rustdoc/tuple-struct-34928.rs | 2 ++ 18 files changed, 33 insertions(+) (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/doctest-include-43153.rs b/tests/rustdoc/doctest-include-43153.rs index 0fe680f10af..ec21a68c4ee 100644 --- a/tests/rustdoc/doctest-include-43153.rs +++ b/tests/rustdoc/doctest-include-43153.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/43153 + // Test that `include!` in a doc test searches relative to the directory in // which the test is declared. diff --git a/tests/rustdoc/doctest-macro-38219.rs b/tests/rustdoc/doctest-macro-38219.rs index fa57c58c761..6c81df11085 100644 --- a/tests/rustdoc/doctest-macro-38219.rs +++ b/tests/rustdoc/doctest-macro-38219.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/38219 + // compile-flags:--test // should-fail diff --git a/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs b/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs index c32bcf380ea..d481dc0dd70 100644 --- a/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs +++ b/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs @@ -1,5 +1,7 @@ // compile-flags:--test +// https://github.com/rust-lang/rust/issues/48377 + //! This is a doc comment //! //! ```rust diff --git a/tests/rustdoc/enum-variant-private-46767.rs b/tests/rustdoc/enum-variant-private-46767.rs index ef6ed104b74..6386aa75a95 100644 --- a/tests/rustdoc/enum-variant-private-46767.rs +++ b/tests/rustdoc/enum-variant-private-46767.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/46767 #![crate_name = "foo"] mod private { diff --git a/tests/rustdoc/enum-variant-reexport-46766.rs b/tests/rustdoc/enum-variant-reexport-46766.rs index 36ab739565b..ea6b7bac4c7 100644 --- a/tests/rustdoc/enum-variant-reexport-46766.rs +++ b/tests/rustdoc/enum-variant-reexport-46766.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/46766 #![crate_name = "foo"] pub enum Enum{Variant} diff --git a/tests/rustdoc/foreign-implementors-js-43701.rs b/tests/rustdoc/foreign-implementors-js-43701.rs index de772881e73..3b16ad2045a 100644 --- a/tests/rustdoc/foreign-implementors-js-43701.rs +++ b/tests/rustdoc/foreign-implementors-js-43701.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/43701 #![crate_name = "foo"] pub use std::vec::Vec; diff --git a/tests/rustdoc/ice-34423.rs b/tests/rustdoc/ice-34423.rs index b429bf8c9ba..42e57ac7258 100644 --- a/tests/rustdoc/ice-34423.rs +++ b/tests/rustdoc/ice-34423.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/34423 + pub struct Foo; pub trait Bar { diff --git a/tests/rustdoc/ice-36031.rs b/tests/rustdoc/ice-36031.rs index af1b32fd22b..9f091384dfe 100644 --- a/tests/rustdoc/ice-36031.rs +++ b/tests/rustdoc/ice-36031.rs @@ -2,6 +2,8 @@ // build-aux-docs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/36031 + #![crate_name = "foo"] extern crate issue_36031; diff --git a/tests/rustdoc/ice-apit-46976.rs b/tests/rustdoc/ice-apit-46976.rs index c59f8c72e64..e51cee2f056 100644 --- a/tests/rustdoc/ice-apit-46976.rs +++ b/tests/rustdoc/ice-apit-46976.rs @@ -1 +1,3 @@ +// https://github.com/rust-lang/rust/issues/46976 + pub fn ice(f: impl Fn()) {} diff --git a/tests/rustdoc/ice-circular-intra-doc-link-48414.rs b/tests/rustdoc/ice-circular-intra-doc-link-48414.rs index b35743d887b..68dda3a25bb 100644 --- a/tests/rustdoc/ice-circular-intra-doc-link-48414.rs +++ b/tests/rustdoc/ice-circular-intra-doc-link-48414.rs @@ -1,5 +1,7 @@ // aux-build:issue-48414.rs +// https://github.com/rust-lang/rust/issues/48414 + // ICE when resolving paths for a trait that linked to another trait, when both were in an external // crate diff --git a/tests/rustdoc/ice-extern-crate-40936.rs b/tests/rustdoc/ice-extern-crate-40936.rs index 4d2e4c17b1f..fafa4597174 100644 --- a/tests/rustdoc/ice-extern-crate-40936.rs +++ b/tests/rustdoc/ice-extern-crate-40936.rs @@ -1,6 +1,8 @@ // aux-build:issue-40936.rs // build-aux-docs +// https://github.com/rust-lang/rust/issues/40936 + #![crate_name = "foo"] extern crate issue_40936; diff --git a/tests/rustdoc/ice-nested-extern-crate-46271.rs b/tests/rustdoc/ice-nested-extern-crate-46271.rs index b38ef20c551..820a63f3498 100644 --- a/tests/rustdoc/ice-nested-extern-crate-46271.rs +++ b/tests/rustdoc/ice-nested-extern-crate-46271.rs @@ -1,5 +1,7 @@ // hopefully this doesn't cause an ICE +// https://github.com/rust-lang/rust/issues/46271 + pub fn foo() { extern crate std; } diff --git a/tests/rustdoc/ice-nested-macro-rules-47639.rs b/tests/rustdoc/ice-nested-macro-rules-47639.rs index 4b3456b86c5..c38dc2810cf 100644 --- a/tests/rustdoc/ice-nested-macro-rules-47639.rs +++ b/tests/rustdoc/ice-nested-macro-rules-47639.rs @@ -1,4 +1,6 @@ // This should not ICE + +// https://github.com/rust-lang/rust/issues/47639 pub fn test() { macro_rules! foo { () => () diff --git a/tests/rustdoc/inline-rename-34473.rs b/tests/rustdoc/inline-rename-34473.rs index 37da3dd1999..7bc92cca1af 100644 --- a/tests/rustdoc/inline-rename-34473.rs +++ b/tests/rustdoc/inline-rename-34473.rs @@ -1,5 +1,7 @@ #![crate_name = "foo"] +// https://github.com/rust-lang/rust/issues/34473 + mod second { pub struct SomeTypeWithLongName; } diff --git a/tests/rustdoc/private-use-decl-macro-47038.rs b/tests/rustdoc/private-use-decl-macro-47038.rs index 810ddca3eab..8944bdd42b4 100644 --- a/tests/rustdoc/private-use-decl-macro-47038.rs +++ b/tests/rustdoc/private-use-decl-macro-47038.rs @@ -2,6 +2,8 @@ #![crate_name = "foo"] +// https://github.com/rust-lang/rust/issues/47038 + use std::vec; // @has 'foo/index.html' diff --git a/tests/rustdoc/src-links-implementor-43893.rs b/tests/rustdoc/src-links-implementor-43893.rs index 95d55193459..c16837b6129 100644 --- a/tests/rustdoc/src-links-implementor-43893.rs +++ b/tests/rustdoc/src-links-implementor-43893.rs @@ -1,5 +1,7 @@ // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/43893 + #![crate_name = "foo"] pub trait SomeTrait {} diff --git a/tests/rustdoc/trait-implementations-duplicate-self-45584.rs b/tests/rustdoc/trait-implementations-duplicate-self-45584.rs index 8a5f0413826..77b8c05f2fb 100644 --- a/tests/rustdoc/trait-implementations-duplicate-self-45584.rs +++ b/tests/rustdoc/trait-implementations-duplicate-self-45584.rs @@ -1,5 +1,7 @@ #![crate_name = "foo"] +// https://github.com/rust-lang/rust/issues/45584 + pub trait Bar {} // @has 'foo/struct.Foo1.html' diff --git a/tests/rustdoc/tuple-struct-34928.rs b/tests/rustdoc/tuple-struct-34928.rs index 4184086f622..909b9146893 100644 --- a/tests/rustdoc/tuple-struct-34928.rs +++ b/tests/rustdoc/tuple-struct-34928.rs @@ -1,5 +1,7 @@ #![crate_name = "foo"] +// https://github.com/rust-lang/rust/issues/34928 + pub trait Bar {} // @has foo/struct.Foo.html '//pre' 'pub struct Foo(pub T) where T: Bar;' -- cgit 1.4.1-3-g733a5 From cbe68435c603da438b8994c1a583b46fc01821cf Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 20 Nov 2023 11:59:29 -0700 Subject: Fix src link URLs for file rename --- tests/rustdoc/src-links-implementor-43893.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/src-links-implementor-43893.rs b/tests/rustdoc/src-links-implementor-43893.rs index c16837b6129..07e672847ca 100644 --- a/tests/rustdoc/src-links-implementor-43893.rs +++ b/tests/rustdoc/src-links-implementor-43893.rs @@ -7,15 +7,15 @@ pub trait SomeTrait {} pub struct SomeStruct; -// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#9' +// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/src-links-implementor-43893.rs.html#11' impl SomeTrait for usize {} -// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#12-14' +// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/src-links-implementor-43893.rs.html#14-16' impl SomeTrait for SomeStruct { // deliberately multi-line impl } pub trait AnotherTrait {} -// @has foo/trait.AnotherTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#19' +// @has foo/trait.AnotherTrait.html '//a/@href' '../src/foo/src-links-implementor-43893.rs.html#21' impl AnotherTrait for T {} -- cgit 1.4.1-3-g733a5 From fdde5c77a834c8275c23648ddaca9c18adee07d4 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 23 Nov 2023 14:54:19 -0700 Subject: rustdoc: move ICE tests to ui --- tests/rustdoc-ui/apit-46976.rs | 4 ++++ tests/rustdoc-ui/auxiliary/issue-36031.rs | 9 +++++++++ tests/rustdoc-ui/auxiliary/issue-40936.rs | 5 +++++ tests/rustdoc-ui/auxiliary/issue-48414.rs | 5 +++++ tests/rustdoc-ui/circular-intra-doc-link-48414.rs | 14 ++++++++++++++ tests/rustdoc-ui/hidden-trait-method-34423.rs | 13 +++++++++++++ tests/rustdoc-ui/inherent-assoc-consts-36031.rs | 12 ++++++++++++ tests/rustdoc-ui/nested-extern-crate-46271.rs | 8 ++++++++ tests/rustdoc-ui/nested-macro-rules-47639.rs | 9 +++++++++ tests/rustdoc-ui/super-glob-40936.rs | 9 +++++++++ tests/rustdoc/auxiliary/issue-36031.rs | 9 --------- tests/rustdoc/auxiliary/issue-40936.rs | 5 ----- tests/rustdoc/auxiliary/issue-48414.rs | 5 ----- tests/rustdoc/enum-variant-reexport-46766.rs | 7 ------- tests/rustdoc/ice-34423.rs | 12 ------------ tests/rustdoc/ice-36031.rs | 11 ----------- tests/rustdoc/ice-apit-46976.rs | 3 --- tests/rustdoc/ice-circular-intra-doc-link-48414.rs | 13 ------------- tests/rustdoc/ice-extern-crate-40936.rs | 8 -------- tests/rustdoc/ice-nested-extern-crate-46271.rs | 7 ------- tests/rustdoc/ice-nested-macro-rules-47639.rs | 8 -------- tests/rustdoc/inline_local/enum-variant-reexport-46766.rs | 7 +++++++ tests/rustdoc/tuple-struct-34928.rs | 8 -------- tests/rustdoc/tuple-struct-where-clause-34928.rs | 8 ++++++++ 24 files changed, 103 insertions(+), 96 deletions(-) create mode 100644 tests/rustdoc-ui/apit-46976.rs create mode 100644 tests/rustdoc-ui/auxiliary/issue-36031.rs create mode 100644 tests/rustdoc-ui/auxiliary/issue-40936.rs create mode 100644 tests/rustdoc-ui/auxiliary/issue-48414.rs create mode 100644 tests/rustdoc-ui/circular-intra-doc-link-48414.rs create mode 100644 tests/rustdoc-ui/hidden-trait-method-34423.rs create mode 100644 tests/rustdoc-ui/inherent-assoc-consts-36031.rs create mode 100644 tests/rustdoc-ui/nested-extern-crate-46271.rs create mode 100644 tests/rustdoc-ui/nested-macro-rules-47639.rs create mode 100644 tests/rustdoc-ui/super-glob-40936.rs delete mode 100644 tests/rustdoc/auxiliary/issue-36031.rs delete mode 100644 tests/rustdoc/auxiliary/issue-40936.rs delete mode 100644 tests/rustdoc/auxiliary/issue-48414.rs delete mode 100644 tests/rustdoc/enum-variant-reexport-46766.rs delete mode 100644 tests/rustdoc/ice-34423.rs delete mode 100644 tests/rustdoc/ice-36031.rs delete mode 100644 tests/rustdoc/ice-apit-46976.rs delete mode 100644 tests/rustdoc/ice-circular-intra-doc-link-48414.rs delete mode 100644 tests/rustdoc/ice-extern-crate-40936.rs delete mode 100644 tests/rustdoc/ice-nested-extern-crate-46271.rs delete mode 100644 tests/rustdoc/ice-nested-macro-rules-47639.rs create mode 100644 tests/rustdoc/inline_local/enum-variant-reexport-46766.rs delete mode 100644 tests/rustdoc/tuple-struct-34928.rs create mode 100644 tests/rustdoc/tuple-struct-where-clause-34928.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc-ui/apit-46976.rs b/tests/rustdoc-ui/apit-46976.rs new file mode 100644 index 00000000000..c17688e3b1d --- /dev/null +++ b/tests/rustdoc-ui/apit-46976.rs @@ -0,0 +1,4 @@ +// check-pass +// https://github.com/rust-lang/rust/issues/46976 + +pub fn ice(f: impl Fn()) {} diff --git a/tests/rustdoc-ui/auxiliary/issue-36031.rs b/tests/rustdoc-ui/auxiliary/issue-36031.rs new file mode 100644 index 00000000000..da688139e34 --- /dev/null +++ b/tests/rustdoc-ui/auxiliary/issue-36031.rs @@ -0,0 +1,9 @@ +pub trait Foo { + const FOO: usize; +} + +pub struct Bar; + +impl Bar { + pub const BAR: usize = 3; +} diff --git a/tests/rustdoc-ui/auxiliary/issue-40936.rs b/tests/rustdoc-ui/auxiliary/issue-40936.rs new file mode 100644 index 00000000000..b921e520173 --- /dev/null +++ b/tests/rustdoc-ui/auxiliary/issue-40936.rs @@ -0,0 +1,5 @@ +pub mod outermod { + pub mod innermod { + pub use super::*; + } +} diff --git a/tests/rustdoc-ui/auxiliary/issue-48414.rs b/tests/rustdoc-ui/auxiliary/issue-48414.rs new file mode 100644 index 00000000000..f442ac72212 --- /dev/null +++ b/tests/rustdoc-ui/auxiliary/issue-48414.rs @@ -0,0 +1,5 @@ +/// Woah, this trait links to [OtherTrait](OtherTrait)! +pub trait SomeTrait {} + +/// Woah, this trait links to [SomeTrait](SomeTrait)! +pub trait OtherTrait {} diff --git a/tests/rustdoc-ui/circular-intra-doc-link-48414.rs b/tests/rustdoc-ui/circular-intra-doc-link-48414.rs new file mode 100644 index 00000000000..46367ccaef9 --- /dev/null +++ b/tests/rustdoc-ui/circular-intra-doc-link-48414.rs @@ -0,0 +1,14 @@ +// aux-build:issue-48414.rs +// check-pass + +// https://github.com/rust-lang/rust/issues/48414 + +// ICE when resolving paths for a trait that linked to another trait, when both were in an external +// crate + +#![crate_name = "base"] + +extern crate issue_48414; + +#[doc(inline)] +pub use issue_48414::{SomeTrait, OtherTrait}; diff --git a/tests/rustdoc-ui/hidden-trait-method-34423.rs b/tests/rustdoc-ui/hidden-trait-method-34423.rs new file mode 100644 index 00000000000..f3107d2379c --- /dev/null +++ b/tests/rustdoc-ui/hidden-trait-method-34423.rs @@ -0,0 +1,13 @@ +// check-pass +// https://github.com/rust-lang/rust/issues/34423 + +pub struct Foo; + +pub trait Bar { + #[doc(hidden)] + fn bar() {} +} + +impl Bar for Foo { + fn bar() {} +} diff --git a/tests/rustdoc-ui/inherent-assoc-consts-36031.rs b/tests/rustdoc-ui/inherent-assoc-consts-36031.rs new file mode 100644 index 00000000000..755fc1cfdff --- /dev/null +++ b/tests/rustdoc-ui/inherent-assoc-consts-36031.rs @@ -0,0 +1,12 @@ +// aux-build:issue-36031.rs +// check-pass +// build-aux-docs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/36031 + +#![crate_name = "foo"] + +extern crate issue_36031; + +pub use issue_36031::Foo; diff --git a/tests/rustdoc-ui/nested-extern-crate-46271.rs b/tests/rustdoc-ui/nested-extern-crate-46271.rs new file mode 100644 index 00000000000..d2ac38f3e45 --- /dev/null +++ b/tests/rustdoc-ui/nested-extern-crate-46271.rs @@ -0,0 +1,8 @@ +// check-pass +// hopefully this doesn't cause an ICE + +// https://github.com/rust-lang/rust/issues/46271 + +pub fn foo() { + extern crate std; +} diff --git a/tests/rustdoc-ui/nested-macro-rules-47639.rs b/tests/rustdoc-ui/nested-macro-rules-47639.rs new file mode 100644 index 00000000000..210b1e79cd2 --- /dev/null +++ b/tests/rustdoc-ui/nested-macro-rules-47639.rs @@ -0,0 +1,9 @@ +// check-pass +// This should not ICE + +// https://github.com/rust-lang/rust/issues/47639 +pub fn test() { + macro_rules! foo { + () => () + } +} diff --git a/tests/rustdoc-ui/super-glob-40936.rs b/tests/rustdoc-ui/super-glob-40936.rs new file mode 100644 index 00000000000..a06e977b10a --- /dev/null +++ b/tests/rustdoc-ui/super-glob-40936.rs @@ -0,0 +1,9 @@ +// aux-build:issue-40936.rs +// check-pass +// build-aux-docs + +// https://github.com/rust-lang/rust/issues/40936 + +#![crate_name = "foo"] + +extern crate issue_40936; diff --git a/tests/rustdoc/auxiliary/issue-36031.rs b/tests/rustdoc/auxiliary/issue-36031.rs deleted file mode 100644 index da688139e34..00000000000 --- a/tests/rustdoc/auxiliary/issue-36031.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub trait Foo { - const FOO: usize; -} - -pub struct Bar; - -impl Bar { - pub const BAR: usize = 3; -} diff --git a/tests/rustdoc/auxiliary/issue-40936.rs b/tests/rustdoc/auxiliary/issue-40936.rs deleted file mode 100644 index b921e520173..00000000000 --- a/tests/rustdoc/auxiliary/issue-40936.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod outermod { - pub mod innermod { - pub use super::*; - } -} diff --git a/tests/rustdoc/auxiliary/issue-48414.rs b/tests/rustdoc/auxiliary/issue-48414.rs deleted file mode 100644 index f442ac72212..00000000000 --- a/tests/rustdoc/auxiliary/issue-48414.rs +++ /dev/null @@ -1,5 +0,0 @@ -/// Woah, this trait links to [OtherTrait](OtherTrait)! -pub trait SomeTrait {} - -/// Woah, this trait links to [SomeTrait](SomeTrait)! -pub trait OtherTrait {} diff --git a/tests/rustdoc/enum-variant-reexport-46766.rs b/tests/rustdoc/enum-variant-reexport-46766.rs deleted file mode 100644 index ea6b7bac4c7..00000000000 --- a/tests/rustdoc/enum-variant-reexport-46766.rs +++ /dev/null @@ -1,7 +0,0 @@ -// https://github.com/rust-lang/rust/issues/46766 -#![crate_name = "foo"] - -pub enum Enum{Variant} -pub use self::Enum::Variant; - -// @!has foo/index.html '//a/@href' './Enum/index.html' diff --git a/tests/rustdoc/ice-34423.rs b/tests/rustdoc/ice-34423.rs deleted file mode 100644 index 42e57ac7258..00000000000 --- a/tests/rustdoc/ice-34423.rs +++ /dev/null @@ -1,12 +0,0 @@ -// https://github.com/rust-lang/rust/issues/34423 - -pub struct Foo; - -pub trait Bar { - #[doc(hidden)] - fn bar() {} -} - -impl Bar for Foo { - fn bar() {} -} diff --git a/tests/rustdoc/ice-36031.rs b/tests/rustdoc/ice-36031.rs deleted file mode 100644 index 9f091384dfe..00000000000 --- a/tests/rustdoc/ice-36031.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:issue-36031.rs -// build-aux-docs -// ignore-cross-compile - -// https://github.com/rust-lang/rust/issues/36031 - -#![crate_name = "foo"] - -extern crate issue_36031; - -pub use issue_36031::Foo; diff --git a/tests/rustdoc/ice-apit-46976.rs b/tests/rustdoc/ice-apit-46976.rs deleted file mode 100644 index e51cee2f056..00000000000 --- a/tests/rustdoc/ice-apit-46976.rs +++ /dev/null @@ -1,3 +0,0 @@ -// https://github.com/rust-lang/rust/issues/46976 - -pub fn ice(f: impl Fn()) {} diff --git a/tests/rustdoc/ice-circular-intra-doc-link-48414.rs b/tests/rustdoc/ice-circular-intra-doc-link-48414.rs deleted file mode 100644 index 68dda3a25bb..00000000000 --- a/tests/rustdoc/ice-circular-intra-doc-link-48414.rs +++ /dev/null @@ -1,13 +0,0 @@ -// aux-build:issue-48414.rs - -// https://github.com/rust-lang/rust/issues/48414 - -// ICE when resolving paths for a trait that linked to another trait, when both were in an external -// crate - -#![crate_name = "base"] - -extern crate issue_48414; - -#[doc(inline)] -pub use issue_48414::{SomeTrait, OtherTrait}; diff --git a/tests/rustdoc/ice-extern-crate-40936.rs b/tests/rustdoc/ice-extern-crate-40936.rs deleted file mode 100644 index fafa4597174..00000000000 --- a/tests/rustdoc/ice-extern-crate-40936.rs +++ /dev/null @@ -1,8 +0,0 @@ -// aux-build:issue-40936.rs -// build-aux-docs - -// https://github.com/rust-lang/rust/issues/40936 - -#![crate_name = "foo"] - -extern crate issue_40936; diff --git a/tests/rustdoc/ice-nested-extern-crate-46271.rs b/tests/rustdoc/ice-nested-extern-crate-46271.rs deleted file mode 100644 index 820a63f3498..00000000000 --- a/tests/rustdoc/ice-nested-extern-crate-46271.rs +++ /dev/null @@ -1,7 +0,0 @@ -// hopefully this doesn't cause an ICE - -// https://github.com/rust-lang/rust/issues/46271 - -pub fn foo() { - extern crate std; -} diff --git a/tests/rustdoc/ice-nested-macro-rules-47639.rs b/tests/rustdoc/ice-nested-macro-rules-47639.rs deleted file mode 100644 index c38dc2810cf..00000000000 --- a/tests/rustdoc/ice-nested-macro-rules-47639.rs +++ /dev/null @@ -1,8 +0,0 @@ -// This should not ICE - -// https://github.com/rust-lang/rust/issues/47639 -pub fn test() { - macro_rules! foo { - () => () - } -} diff --git a/tests/rustdoc/inline_local/enum-variant-reexport-46766.rs b/tests/rustdoc/inline_local/enum-variant-reexport-46766.rs new file mode 100644 index 00000000000..ea6b7bac4c7 --- /dev/null +++ b/tests/rustdoc/inline_local/enum-variant-reexport-46766.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/46766 +#![crate_name = "foo"] + +pub enum Enum{Variant} +pub use self::Enum::Variant; + +// @!has foo/index.html '//a/@href' './Enum/index.html' diff --git a/tests/rustdoc/tuple-struct-34928.rs b/tests/rustdoc/tuple-struct-34928.rs deleted file mode 100644 index 909b9146893..00000000000 --- a/tests/rustdoc/tuple-struct-34928.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_name = "foo"] - -// https://github.com/rust-lang/rust/issues/34928 - -pub trait Bar {} - -// @has foo/struct.Foo.html '//pre' 'pub struct Foo(pub T) where T: Bar;' -pub struct Foo(pub T) where T: Bar; diff --git a/tests/rustdoc/tuple-struct-where-clause-34928.rs b/tests/rustdoc/tuple-struct-where-clause-34928.rs new file mode 100644 index 00000000000..909b9146893 --- /dev/null +++ b/tests/rustdoc/tuple-struct-where-clause-34928.rs @@ -0,0 +1,8 @@ +#![crate_name = "foo"] + +// https://github.com/rust-lang/rust/issues/34928 + +pub trait Bar {} + +// @has foo/struct.Foo.html '//pre' 'pub struct Foo(pub T) where T: Bar;' +pub struct Foo(pub T) where T: Bar; -- cgit 1.4.1-3-g733a5 From 4f64ff171bdd00873d6cdf8301f5cdddf999832f Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 23 Nov 2023 14:56:03 -0700 Subject: rustdoc: move doctest tests to folder --- tests/rustdoc/doctest-cfg-feature-30252.rs | 9 -- tests/rustdoc/doctest-crate-attributes-38129.rs | 99 ---------------------- tests/rustdoc/doctest-hide-empty-line-23106.rs | 10 --- tests/rustdoc/doctest-ignore-32556.rs | 8 -- tests/rustdoc/doctest-include-43153.rs | 12 --- tests/rustdoc/doctest-macro-38219.rs | 10 --- tests/rustdoc/doctest-manual-crate-name.rs | 7 -- .../rustdoc/doctest-markdown-inline-parse-23744.rs | 15 ---- .../doctest-markdown-trailing-docblock-48377.rs | 15 ---- .../doctest-multi-line-string-literal-25944.rs | 14 --- tests/rustdoc/doctest/auxiliary/empty.rs | 1 + tests/rustdoc/doctest/doctest-cfg-feature-30252.rs | 9 ++ .../doctest/doctest-crate-attributes-38129.rs | 99 ++++++++++++++++++++++ .../doctest/doctest-hide-empty-line-23106.rs | 10 +++ tests/rustdoc/doctest/doctest-ignore-32556.rs | 8 ++ tests/rustdoc/doctest/doctest-include-43153.rs | 12 +++ tests/rustdoc/doctest/doctest-macro-38219.rs | 10 +++ tests/rustdoc/doctest/doctest-manual-crate-name.rs | 7 ++ .../doctest/doctest-markdown-inline-parse-23744.rs | 15 ++++ .../doctest-markdown-trailing-docblock-48377.rs | 15 ++++ .../doctest-multi-line-string-literal-25944.rs | 14 +++ 21 files changed, 200 insertions(+), 199 deletions(-) delete mode 100644 tests/rustdoc/doctest-cfg-feature-30252.rs delete mode 100644 tests/rustdoc/doctest-crate-attributes-38129.rs delete mode 100644 tests/rustdoc/doctest-hide-empty-line-23106.rs delete mode 100644 tests/rustdoc/doctest-ignore-32556.rs delete mode 100644 tests/rustdoc/doctest-include-43153.rs delete mode 100644 tests/rustdoc/doctest-macro-38219.rs delete mode 100644 tests/rustdoc/doctest-manual-crate-name.rs delete mode 100644 tests/rustdoc/doctest-markdown-inline-parse-23744.rs delete mode 100644 tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs delete mode 100644 tests/rustdoc/doctest-multi-line-string-literal-25944.rs create mode 100644 tests/rustdoc/doctest/auxiliary/empty.rs create mode 100644 tests/rustdoc/doctest/doctest-cfg-feature-30252.rs create mode 100644 tests/rustdoc/doctest/doctest-crate-attributes-38129.rs create mode 100644 tests/rustdoc/doctest/doctest-hide-empty-line-23106.rs create mode 100644 tests/rustdoc/doctest/doctest-ignore-32556.rs create mode 100644 tests/rustdoc/doctest/doctest-include-43153.rs create mode 100644 tests/rustdoc/doctest/doctest-macro-38219.rs create mode 100644 tests/rustdoc/doctest/doctest-manual-crate-name.rs create mode 100644 tests/rustdoc/doctest/doctest-markdown-inline-parse-23744.rs create mode 100644 tests/rustdoc/doctest/doctest-markdown-trailing-docblock-48377.rs create mode 100644 tests/rustdoc/doctest/doctest-multi-line-string-literal-25944.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/doctest-cfg-feature-30252.rs b/tests/rustdoc/doctest-cfg-feature-30252.rs deleted file mode 100644 index ceb8076fe35..00000000000 --- a/tests/rustdoc/doctest-cfg-feature-30252.rs +++ /dev/null @@ -1,9 +0,0 @@ -// 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-crate-attributes-38129.rs b/tests/rustdoc/doctest-crate-attributes-38129.rs deleted file mode 100644 index 156d50fa52a..00000000000 --- a/tests/rustdoc/doctest-crate-attributes-38129.rs +++ /dev/null @@ -1,99 +0,0 @@ -// compile-flags:--test - -// This file tests the source-partitioning behavior of rustdoc. -// Each test contains some code that should be put into the generated -// `fn main` and some attributes should be left outside (except the first -// one, which has no attributes). -// If the #![recursion_limit] attribute is incorrectly left inside, -// then the tests will fail because the macro recurses 128 times. - -/// ``` -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn simple() {} - -/// ``` -/// #![recursion_limit = "1024"] -/// macro_rules! recurse { -/// (()) => {}; -/// (() $($rest:tt)*) => { recurse!($($rest)*); } -/// } -/// recurse!(() () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () ()); -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn non_feature_attr() {} - -/// ``` -/// #![feature(core_intrinsics)] -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn feature_attr() {} - -/// ``` -/// #![feature(core_intrinsics)] -/// #![recursion_limit = "1024"] -/// macro_rules! recurse { -/// (()) => {}; -/// (() $($rest:tt)*) => { recurse!($($rest)*); } -/// } -/// recurse!(() () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () ()); -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn both_attrs() {} - -/// ``` -/// #![recursion_limit = "1024"] -/// #![feature(core_intrinsics)] -/// macro_rules! recurse { -/// (()) => {}; -/// (() $($rest:tt)*) => { recurse!($($rest)*); } -/// } -/// recurse!(() () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () () -/// () () () () () () () ()); -/// assert_eq!(1 + 1, 2); -/// ``` -pub fn both_attrs_reverse() {} diff --git a/tests/rustdoc/doctest-hide-empty-line-23106.rs b/tests/rustdoc/doctest-hide-empty-line-23106.rs deleted file mode 100644 index 8e1e2cf098c..00000000000 --- a/tests/rustdoc/doctest-hide-empty-line-23106.rs +++ /dev/null @@ -1,10 +0,0 @@ -// 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 deleted file mode 100644 index 99da9358bd6..00000000000 --- a/tests/rustdoc/doctest-ignore-32556.rs +++ /dev/null @@ -1,8 +0,0 @@ -// 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-include-43153.rs b/tests/rustdoc/doctest-include-43153.rs deleted file mode 100644 index ec21a68c4ee..00000000000 --- a/tests/rustdoc/doctest-include-43153.rs +++ /dev/null @@ -1,12 +0,0 @@ -// https://github.com/rust-lang/rust/issues/43153 - -// Test that `include!` in a doc test searches relative to the directory in -// which the test is declared. - -// compile-flags:--test - -/// ```rust -/// include!("auxiliary/empty.rs"); -/// fn main() {} -/// ``` -pub struct Foo; diff --git a/tests/rustdoc/doctest-macro-38219.rs b/tests/rustdoc/doctest-macro-38219.rs deleted file mode 100644 index 6c81df11085..00000000000 --- a/tests/rustdoc/doctest-macro-38219.rs +++ /dev/null @@ -1,10 +0,0 @@ -// https://github.com/rust-lang/rust/issues/38219 - -// compile-flags:--test -// should-fail - -/// ``` -/// fail -/// ``` -#[macro_export] -macro_rules! foo { () => {} } diff --git a/tests/rustdoc/doctest-manual-crate-name.rs b/tests/rustdoc/doctest-manual-crate-name.rs deleted file mode 100644 index 3a5e3734e14..00000000000 --- a/tests/rustdoc/doctest-manual-crate-name.rs +++ /dev/null @@ -1,7 +0,0 @@ -// compile-flags:--test - -//! ``` -//! #![crate_name="asdf"] -//! -//! println!("yo"); -//! ``` diff --git a/tests/rustdoc/doctest-markdown-inline-parse-23744.rs b/tests/rustdoc/doctest-markdown-inline-parse-23744.rs deleted file mode 100644 index 128e2daba07..00000000000 --- a/tests/rustdoc/doctest-markdown-inline-parse-23744.rs +++ /dev/null @@ -1,15 +0,0 @@ -// compile-flags:--test - -// https://github.com/rust-lang/rust/issues/23744 -#![crate_name="issue_23744"] - -/// Example of rustdoc incorrectly parsing ```rust,should_panic. -/// -/// ```should_panic -/// fn main() { panic!("fee"); } -/// ``` -/// -/// ```rust,should_panic -/// fn main() { panic!("fum"); } -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs b/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs deleted file mode 100644 index d481dc0dd70..00000000000 --- a/tests/rustdoc/doctest-markdown-trailing-docblock-48377.rs +++ /dev/null @@ -1,15 +0,0 @@ -// compile-flags:--test - -// https://github.com/rust-lang/rust/issues/48377 - -//! This is a doc comment -//! -//! ```rust -//! fn main() {} -//! ``` -//! -//! With a trailing code fence -//! ``` - -/// Some foo function -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 deleted file mode 100644 index eec796e4fbf..00000000000 --- a/tests/rustdoc/doctest-multi-line-string-literal-25944.rs +++ /dev/null @@ -1,14 +0,0 @@ -// 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/doctest/auxiliary/empty.rs b/tests/rustdoc/doctest/auxiliary/empty.rs new file mode 100644 index 00000000000..d11c69f812a --- /dev/null +++ b/tests/rustdoc/doctest/auxiliary/empty.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/rustdoc/doctest/doctest-cfg-feature-30252.rs b/tests/rustdoc/doctest/doctest-cfg-feature-30252.rs new file mode 100644 index 00000000000..ceb8076fe35 --- /dev/null +++ b/tests/rustdoc/doctest/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/doctest-crate-attributes-38129.rs b/tests/rustdoc/doctest/doctest-crate-attributes-38129.rs new file mode 100644 index 00000000000..156d50fa52a --- /dev/null +++ b/tests/rustdoc/doctest/doctest-crate-attributes-38129.rs @@ -0,0 +1,99 @@ +// compile-flags:--test + +// This file tests the source-partitioning behavior of rustdoc. +// Each test contains some code that should be put into the generated +// `fn main` and some attributes should be left outside (except the first +// one, which has no attributes). +// If the #![recursion_limit] attribute is incorrectly left inside, +// then the tests will fail because the macro recurses 128 times. + +/// ``` +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn simple() {} + +/// ``` +/// #![recursion_limit = "1024"] +/// macro_rules! recurse { +/// (()) => {}; +/// (() $($rest:tt)*) => { recurse!($($rest)*); } +/// } +/// recurse!(() () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () ()); +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn non_feature_attr() {} + +/// ``` +/// #![feature(core_intrinsics)] +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn feature_attr() {} + +/// ``` +/// #![feature(core_intrinsics)] +/// #![recursion_limit = "1024"] +/// macro_rules! recurse { +/// (()) => {}; +/// (() $($rest:tt)*) => { recurse!($($rest)*); } +/// } +/// recurse!(() () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () ()); +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn both_attrs() {} + +/// ``` +/// #![recursion_limit = "1024"] +/// #![feature(core_intrinsics)] +/// macro_rules! recurse { +/// (()) => {}; +/// (() $($rest:tt)*) => { recurse!($($rest)*); } +/// } +/// recurse!(() () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () () +/// () () () () () () () ()); +/// assert_eq!(1 + 1, 2); +/// ``` +pub fn both_attrs_reverse() {} diff --git a/tests/rustdoc/doctest/doctest-hide-empty-line-23106.rs b/tests/rustdoc/doctest/doctest-hide-empty-line-23106.rs new file mode 100644 index 00000000000..8e1e2cf098c --- /dev/null +++ b/tests/rustdoc/doctest/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/doctest-ignore-32556.rs b/tests/rustdoc/doctest/doctest-ignore-32556.rs new file mode 100644 index 00000000000..99da9358bd6 --- /dev/null +++ b/tests/rustdoc/doctest/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/doctest-include-43153.rs b/tests/rustdoc/doctest/doctest-include-43153.rs new file mode 100644 index 00000000000..ec21a68c4ee --- /dev/null +++ b/tests/rustdoc/doctest/doctest-include-43153.rs @@ -0,0 +1,12 @@ +// https://github.com/rust-lang/rust/issues/43153 + +// Test that `include!` in a doc test searches relative to the directory in +// which the test is declared. + +// compile-flags:--test + +/// ```rust +/// include!("auxiliary/empty.rs"); +/// fn main() {} +/// ``` +pub struct Foo; diff --git a/tests/rustdoc/doctest/doctest-macro-38219.rs b/tests/rustdoc/doctest/doctest-macro-38219.rs new file mode 100644 index 00000000000..6c81df11085 --- /dev/null +++ b/tests/rustdoc/doctest/doctest-macro-38219.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/38219 + +// compile-flags:--test +// should-fail + +/// ``` +/// fail +/// ``` +#[macro_export] +macro_rules! foo { () => {} } diff --git a/tests/rustdoc/doctest/doctest-manual-crate-name.rs b/tests/rustdoc/doctest/doctest-manual-crate-name.rs new file mode 100644 index 00000000000..3a5e3734e14 --- /dev/null +++ b/tests/rustdoc/doctest/doctest-manual-crate-name.rs @@ -0,0 +1,7 @@ +// compile-flags:--test + +//! ``` +//! #![crate_name="asdf"] +//! +//! println!("yo"); +//! ``` diff --git a/tests/rustdoc/doctest/doctest-markdown-inline-parse-23744.rs b/tests/rustdoc/doctest/doctest-markdown-inline-parse-23744.rs new file mode 100644 index 00000000000..128e2daba07 --- /dev/null +++ b/tests/rustdoc/doctest/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 ```rust,should_panic. +/// +/// ```should_panic +/// fn main() { panic!("fee"); } +/// ``` +/// +/// ```rust,should_panic +/// fn main() { panic!("fum"); } +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc/doctest/doctest-markdown-trailing-docblock-48377.rs b/tests/rustdoc/doctest/doctest-markdown-trailing-docblock-48377.rs new file mode 100644 index 00000000000..d481dc0dd70 --- /dev/null +++ b/tests/rustdoc/doctest/doctest-markdown-trailing-docblock-48377.rs @@ -0,0 +1,15 @@ +// compile-flags:--test + +// https://github.com/rust-lang/rust/issues/48377 + +//! This is a doc comment +//! +//! ```rust +//! fn main() {} +//! ``` +//! +//! With a trailing code fence +//! ``` + +/// Some foo function +pub fn foo() {} diff --git a/tests/rustdoc/doctest/doctest-multi-line-string-literal-25944.rs b/tests/rustdoc/doctest/doctest-multi-line-string-literal-25944.rs new file mode 100644 index 00000000000..eec796e4fbf --- /dev/null +++ b/tests/rustdoc/doctest/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() { +} -- cgit 1.4.1-3-g733a5