From 31052bb8a493acbecbdd38860dc20c3c9903069a Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 6 Apr 2024 14:41:09 -0700 Subject: Add URL and crate_name to test cases --- tests/rustdoc/issue-56701.rs | 1 + tests/rustdoc/issue-56822.rs | 5 ++++- tests/rustdoc/issue-57180.rs | 1 + tests/rustdoc/issue-60482.rs | 1 + tests/rustdoc/issue-60726.rs | 5 ++++- tests/rustdoc/issue-61592.rs | 6 ++++-- tests/rustdoc/issue-67851-both.rs | 6 ++++-- tests/rustdoc/issue-67851-hidden.rs | 6 ++++-- tests/rustdoc/issue-67851-neither.rs | 7 +++++-- tests/rustdoc/issue-67851-private.rs | 6 ++++-- tests/rustdoc/issue-72340.rs | 2 ++ tests/rustdoc/issue-74083.rs | 5 ++++- tests/rustdoc/issue-75588.rs | 1 + tests/rustdoc/issue-76501.rs | 7 +++++-- tests/rustdoc/issue-78673.rs | 1 + tests/rustdoc/issue-78701.rs | 1 + tests/rustdoc/issue-79201.rs | 5 ++++- 17 files changed, 50 insertions(+), 16 deletions(-) (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/issue-56701.rs b/tests/rustdoc/issue-56701.rs index ba00743fcd1..d4e94323846 100644 --- a/tests/rustdoc/issue-56701.rs +++ b/tests/rustdoc/issue-56701.rs @@ -1,4 +1,5 @@ // This shouldn't cause a stack overflow when rustdoc is run +// https://github.com/rust-lang/rust/issues/56701 use std::ops::Deref; use std::ops::DerefMut; diff --git a/tests/rustdoc/issue-56822.rs b/tests/rustdoc/issue-56822.rs index c9a74335702..315b20ddd70 100644 --- a/tests/rustdoc/issue-56822.rs +++ b/tests/rustdoc/issue-56822.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/56822 +#![crate_name="foo"] + struct Wrapper(T); trait MyTrait { @@ -16,7 +19,7 @@ impl<'a, T> MyTrait for Inner<'a, T> { type Output = &'a T; } -// @has issue_56822/struct.Parser.html +// @has foo/struct.Parser.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<'a> Send for Parser<'a>" pub struct Parser<'a> { diff --git a/tests/rustdoc/issue-57180.rs b/tests/rustdoc/issue-57180.rs index aa6b7758399..264b53cbd9a 100644 --- a/tests/rustdoc/issue-57180.rs +++ b/tests/rustdoc/issue-57180.rs @@ -1,4 +1,5 @@ //@ aux-build:issue-57180.rs +// https://github.com/rust-lang/rust/issues/57180 extern crate issue_57180; use issue_57180::Trait; diff --git a/tests/rustdoc/issue-60482.rs b/tests/rustdoc/issue-60482.rs index 0fd1daa746d..e40af12e022 100644 --- a/tests/rustdoc/issue-60482.rs +++ b/tests/rustdoc/issue-60482.rs @@ -1,4 +1,5 @@ // This code caused a panic in `pulldown-cmark` 0.4.1. +// https://github.com/rust-lang/rust/issues/60482 pub const BASIC_UNICODE: bool = true; diff --git a/tests/rustdoc/issue-60726.rs b/tests/rustdoc/issue-60726.rs index e337e4a4f7a..ea10aee58e4 100644 --- a/tests/rustdoc/issue-60726.rs +++ b/tests/rustdoc/issue-60726.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/60726 +#![crate_name="foo"] + use std::marker::PhantomData; pub struct True; @@ -25,7 +28,7 @@ where I:InterfaceType {} -// @has issue_60726/struct.IntoIter.html +// @has foo/struct.IntoIter.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl !Send for IntoIter" // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ diff --git a/tests/rustdoc/issue-61592.rs b/tests/rustdoc/issue-61592.rs index 068310fa6a3..d403f2cc7ab 100644 --- a/tests/rustdoc/issue-61592.rs +++ b/tests/rustdoc/issue-61592.rs @@ -1,14 +1,16 @@ //@ aux-build:issue-61592.rs +// https://github.com/rust-lang/rust/issues/61592 +#![crate_name="bar"] extern crate foo; -// @has issue_61592/index.html +// @has bar/index.html // @has - '//a[@href="#reexports"]' 'Re-exports' // @has - '//code' 'pub use foo::FooTrait as _;' // @!has - '//a[@href="trait._.html"]' '' pub use foo::FooTrait as _; -// @has issue_61592/index.html +// @has bar/index.html // @has - '//a[@href="#reexports"]' 'Re-exports' // @has - '//code' 'pub use foo::FooStruct as _;' // @!has - '//a[@href="struct._.html"]' '' diff --git a/tests/rustdoc/issue-67851-both.rs b/tests/rustdoc/issue-67851-both.rs index ed59652838e..e6eb6a68ffd 100644 --- a/tests/rustdoc/issue-67851-both.rs +++ b/tests/rustdoc/issue-67851-both.rs @@ -1,8 +1,10 @@ //@ compile-flags: -Zunstable-options --document-private-items --document-hidden-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] -// @has issue_67851_both/struct.Hidden.html +// @has foo/struct.Hidden.html #[doc(hidden)] pub struct Hidden; -// @has issue_67851_both/struct.Private.html +// @has foo/struct.Private.html struct Private; diff --git a/tests/rustdoc/issue-67851-hidden.rs b/tests/rustdoc/issue-67851-hidden.rs index 6d532adc06f..9767f9c84f9 100644 --- a/tests/rustdoc/issue-67851-hidden.rs +++ b/tests/rustdoc/issue-67851-hidden.rs @@ -1,8 +1,10 @@ //@ compile-flags: -Zunstable-options --document-hidden-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] -// @has issue_67851_hidden/struct.Hidden.html +// @has foo/struct.Hidden.html #[doc(hidden)] pub struct Hidden; -// @!has issue_67851_hidden/struct.Private.html +// @!has foo/struct.Private.html struct Private; diff --git a/tests/rustdoc/issue-67851-neither.rs b/tests/rustdoc/issue-67851-neither.rs index 4e3cd832853..6c6e84da43d 100644 --- a/tests/rustdoc/issue-67851-neither.rs +++ b/tests/rustdoc/issue-67851-neither.rs @@ -1,6 +1,9 @@ -// @!has issue_67851_neither/struct.Hidden.html +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +// @!has foo/struct.Hidden.html #[doc(hidden)] pub struct Hidden; -// @!has issue_67851_neither/struct.Private.html +// @!has foo/struct.Private.html struct Private; diff --git a/tests/rustdoc/issue-67851-private.rs b/tests/rustdoc/issue-67851-private.rs index ead7ddf397f..4aa39f5b789 100644 --- a/tests/rustdoc/issue-67851-private.rs +++ b/tests/rustdoc/issue-67851-private.rs @@ -1,8 +1,10 @@ //@ compile-flags: --document-private-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] -// @!has issue_67851_private/struct.Hidden.html +// @!has foo/struct.Hidden.html #[doc(hidden)] pub struct Hidden; -// @has issue_67851_private/struct.Private.html +// @has foo/struct.Private.html struct Private; diff --git a/tests/rustdoc/issue-72340.rs b/tests/rustdoc/issue-72340.rs index 64044cfe947..880a308f9ab 100644 --- a/tests/rustdoc/issue-72340.rs +++ b/tests/rustdoc/issue-72340.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/72340 + #![crate_name = "foo"] pub struct Body; diff --git a/tests/rustdoc/issue-74083.rs b/tests/rustdoc/issue-74083.rs index c7f5d7eaa58..0bed7e2fb62 100644 --- a/tests/rustdoc/issue-74083.rs +++ b/tests/rustdoc/issue-74083.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/74083 +#![crate_name="foo"] + use std::ops::Deref; pub struct Foo; @@ -6,7 +9,7 @@ impl Foo { pub fn foo(&mut self) {} } -// @has issue_74083/struct.Bar.html +// @has foo/struct.Bar.html // @!has - '//div[@class="sidebar-links"]/a[@href="#method.foo"]' 'foo' pub struct Bar { foo: Foo, diff --git a/tests/rustdoc/issue-75588.rs b/tests/rustdoc/issue-75588.rs index 4f790994b41..befddf6b788 100644 --- a/tests/rustdoc/issue-75588.rs +++ b/tests/rustdoc/issue-75588.rs @@ -2,6 +2,7 @@ //@ aux-build:real_gimli.rs // Ensure unstably exported traits have their Implementors sections. +// https://github.com/rust-lang/rust/issues/75588 #![crate_name = "foo"] #![feature(extremely_unstable_foo)] diff --git a/tests/rustdoc/issue-76501.rs b/tests/rustdoc/issue-76501.rs index 5caea0ec992..4a7284f9851 100644 --- a/tests/rustdoc/issue-76501.rs +++ b/tests/rustdoc/issue-76501.rs @@ -1,4 +1,7 @@ -// @has 'issue_76501/fn.bloop.html' '//pre' 'pub const fn bloop() -> i32' +// https://github.com/rust-lang/rust/issues/76501 +#![crate_name="foo"] + +// @has 'foo/fn.bloop.html' '//pre' 'pub const fn bloop() -> i32' /// A useless function that always returns 1. pub const fn bloop() -> i32 { 1 @@ -8,7 +11,7 @@ pub const fn bloop() -> i32 { pub struct Struct {} impl Struct { - // @has 'issue_76501/struct.Struct.html' '//*[@class="method"]' \ + // @has 'foo/struct.Struct.html' '//*[@class="method"]' \ // 'pub const fn blurp() -> i32' /// A useless function that always returns 1. pub const fn blurp() -> i32 { diff --git a/tests/rustdoc/issue-78673.rs b/tests/rustdoc/issue-78673.rs index d09141c3204..d7ceef2c057 100644 --- a/tests/rustdoc/issue-78673.rs +++ b/tests/rustdoc/issue-78673.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/78673 #![crate_name = "issue_78673"] pub trait Something {} diff --git a/tests/rustdoc/issue-78701.rs b/tests/rustdoc/issue-78701.rs index 3f1638d5ffc..89b7ccb5222 100644 --- a/tests/rustdoc/issue-78701.rs +++ b/tests/rustdoc/issue-78701.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/78701 #![crate_name = "foo"] // This test ensures that if a blanket impl has the same ID as another impl, it'll diff --git a/tests/rustdoc/issue-79201.rs b/tests/rustdoc/issue-79201.rs index f95d79cd493..76260c4a502 100644 --- a/tests/rustdoc/issue-79201.rs +++ b/tests/rustdoc/issue-79201.rs @@ -1,6 +1,9 @@ +// https://github.com/rust-lang/rust/issues/79201 +#![crate_name="foo"] + #![feature(doc_cfg)] -// @has 'issue_79201/trait.Foo.html' +// @has 'foo/trait.Foo.html' // @count - '//*[@class="stab portability"]' 6 // @matches - '//*[@class="stab portability"]' 'crate feature foo-root' // @matches - '//*[@class="stab portability"]' 'crate feature foo-public-mod' -- cgit 1.4.1-3-g733a5 From 381a0e3cb0a71cbef439be974135562e64d40f38 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 6 Apr 2024 14:41:59 -0700 Subject: Move ice tests to rustdoc-ui --- tests/rustdoc-ui/auxiliary/issue-73061.rs | 17 +++++++++++ tests/rustdoc-ui/ice-blanket-impl-56701.rs | 35 ++++++++++++++++++++++ .../ice-cross-crate-opaque-assoc-type-73061.rs | 15 ++++++++++ tests/rustdoc/auxiliary/issue-73061.rs | 17 ----------- tests/rustdoc/issue-56701.rs | 34 --------------------- .../issue-73061-cross-crate-opaque-assoc-type.rs | 14 --------- 6 files changed, 67 insertions(+), 65 deletions(-) create mode 100644 tests/rustdoc-ui/auxiliary/issue-73061.rs create mode 100644 tests/rustdoc-ui/ice-blanket-impl-56701.rs create mode 100644 tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs delete mode 100644 tests/rustdoc/auxiliary/issue-73061.rs delete mode 100644 tests/rustdoc/issue-56701.rs delete mode 100644 tests/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc-ui/auxiliary/issue-73061.rs b/tests/rustdoc-ui/auxiliary/issue-73061.rs new file mode 100644 index 00000000000..9a2e4aaf75e --- /dev/null +++ b/tests/rustdoc-ui/auxiliary/issue-73061.rs @@ -0,0 +1,17 @@ +//@edition:2018 + +#![feature(impl_trait_in_assoc_type)] + +pub trait Foo { + type X: std::future::Future; + fn x(&self) -> Self::X; +} + +pub struct F; + +impl Foo for F { + type X = impl std::future::Future; + fn x(&self) -> Self::X { + async {} + } +} diff --git a/tests/rustdoc-ui/ice-blanket-impl-56701.rs b/tests/rustdoc-ui/ice-blanket-impl-56701.rs new file mode 100644 index 00000000000..13b0fc9032a --- /dev/null +++ b/tests/rustdoc-ui/ice-blanket-impl-56701.rs @@ -0,0 +1,35 @@ +//@ check-pass +// This shouldn't cause a stack overflow when rustdoc is run +// https://github.com/rust-lang/rust/issues/56701 + +use std::ops::Deref; +use std::ops::DerefMut; + +pub trait SimpleTrait { + type SimpleT; +} + +impl> SimpleTrait for Outer { + type SimpleT = Inner::SimpleT; +} + +pub trait AnotherTrait { + type AnotherT; +} + +impl>> AnotherTrait for Simple { + type AnotherT = T; +} + +pub struct Unrelated>>(UnrelatedT); + +impl>> Deref for Unrelated { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + + +pub fn main() { } diff --git a/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs b/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs new file mode 100644 index 00000000000..1434bef49e0 --- /dev/null +++ b/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs @@ -0,0 +1,15 @@ +// Regression test for ICE https://github.com/rust-lang/rust/issues/73061 + +//@ check-pass +//@ aux-build:issue-73061.rs + +extern crate issue_73061; + +pub struct Z; + +impl issue_73061::Foo for Z { + type X = ::X; + fn x(&self) -> Self::X { + issue_73061::F.x() + } +} diff --git a/tests/rustdoc/auxiliary/issue-73061.rs b/tests/rustdoc/auxiliary/issue-73061.rs deleted file mode 100644 index 9a2e4aaf75e..00000000000 --- a/tests/rustdoc/auxiliary/issue-73061.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@edition:2018 - -#![feature(impl_trait_in_assoc_type)] - -pub trait Foo { - type X: std::future::Future; - fn x(&self) -> Self::X; -} - -pub struct F; - -impl Foo for F { - type X = impl std::future::Future; - fn x(&self) -> Self::X { - async {} - } -} diff --git a/tests/rustdoc/issue-56701.rs b/tests/rustdoc/issue-56701.rs deleted file mode 100644 index d4e94323846..00000000000 --- a/tests/rustdoc/issue-56701.rs +++ /dev/null @@ -1,34 +0,0 @@ -// This shouldn't cause a stack overflow when rustdoc is run -// https://github.com/rust-lang/rust/issues/56701 - -use std::ops::Deref; -use std::ops::DerefMut; - -pub trait SimpleTrait { - type SimpleT; -} - -impl> SimpleTrait for Outer { - type SimpleT = Inner::SimpleT; -} - -pub trait AnotherTrait { - type AnotherT; -} - -impl>> AnotherTrait for Simple { - type AnotherT = T; -} - -pub struct Unrelated>>(UnrelatedT); - -impl>> Deref for Unrelated { - type Target = Vec; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - - -pub fn main() { } diff --git a/tests/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs b/tests/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs deleted file mode 100644 index e16aeac65cc..00000000000 --- a/tests/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Regression test for ICE #73061 - -//@ aux-build:issue-73061.rs - -extern crate issue_73061; - -pub struct Z; - -impl issue_73061::Foo for Z { - type X = ::X; - fn x(&self) -> Self::X { - issue_73061::F.x() - } -} -- cgit 1.4.1-3-g733a5 From 9a577e81c38e7ba88089c68c3e37d36a9816717b Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 6 Apr 2024 14:58:34 -0700 Subject: rustdoc: rename `issue-\d+.rs` tests to have meaningful names --- tests/rustdoc/auto-trait-lifetimes-56822.rs | 27 +++++++++++++ tests/rustdoc/blanket-impl-78673.rs | 25 ++++++++++++ tests/rustdoc/const-fn-76501.rs | 20 ++++++++++ tests/rustdoc/doc-cfg-inherit-from-module-79201.rs | 44 ++++++++++++++++++++++ tests/rustdoc/doc-hidden-private-67851-both.rs | 10 +++++ tests/rustdoc/doc-hidden-private-67851-hidden.rs | 10 +++++ tests/rustdoc/doc-hidden-private-67851-neither.rs | 9 +++++ tests/rustdoc/doc-hidden-private-67851-private.rs | 10 +++++ tests/rustdoc/duplicated-glob-reexport-60522.rs | 39 +++++++++++++++++++ .../hide-mut-methods-if-no-derefmut-impl-74083.rs | 24 ++++++++++++ tests/rustdoc/ice-import-crate-57180.rs | 8 ++++ tests/rustdoc/implementors-unstable-75588.rs | 18 +++++++++ .../intra-doc-link-method-trait-impl-72340.rs | 21 +++++++++++ tests/rustdoc/issue-56822.rs | 27 ------------- tests/rustdoc/issue-57180.rs | 8 ---- tests/rustdoc/issue-60482.rs | 10 ----- .../issue-60522-duplicated-glob-reexport.rs | 39 ------------------- tests/rustdoc/issue-60726.rs | 38 ------------------- tests/rustdoc/issue-61592.rs | 17 --------- tests/rustdoc/issue-67851-both.rs | 10 ----- tests/rustdoc/issue-67851-hidden.rs | 10 ----- tests/rustdoc/issue-67851-neither.rs | 9 ----- tests/rustdoc/issue-67851-private.rs | 10 ----- tests/rustdoc/issue-72340.rs | 21 ----------- tests/rustdoc/issue-74083.rs | 24 ------------ tests/rustdoc/issue-75588.rs | 18 --------- tests/rustdoc/issue-76501.rs | 20 ---------- tests/rustdoc/issue-78673.rs | 25 ------------ tests/rustdoc/issue-78701.rs | 21 ----------- tests/rustdoc/issue-79201.rs | 44 ---------------------- tests/rustdoc/markdown-60482.rs | 10 +++++ tests/rustdoc/send-impl-conditional-60726.rs | 38 +++++++++++++++++++ .../sidebar-trait-impl-disambiguate-78701.rs | 21 +++++++++++ tests/rustdoc/underscore-import-61592.rs | 17 +++++++++ 34 files changed, 351 insertions(+), 351 deletions(-) create mode 100644 tests/rustdoc/auto-trait-lifetimes-56822.rs create mode 100644 tests/rustdoc/blanket-impl-78673.rs create mode 100644 tests/rustdoc/const-fn-76501.rs create mode 100644 tests/rustdoc/doc-cfg-inherit-from-module-79201.rs create mode 100644 tests/rustdoc/doc-hidden-private-67851-both.rs create mode 100644 tests/rustdoc/doc-hidden-private-67851-hidden.rs create mode 100644 tests/rustdoc/doc-hidden-private-67851-neither.rs create mode 100644 tests/rustdoc/doc-hidden-private-67851-private.rs create mode 100644 tests/rustdoc/duplicated-glob-reexport-60522.rs create mode 100644 tests/rustdoc/hide-mut-methods-if-no-derefmut-impl-74083.rs create mode 100644 tests/rustdoc/ice-import-crate-57180.rs create mode 100644 tests/rustdoc/implementors-unstable-75588.rs create mode 100644 tests/rustdoc/intra-doc-link-method-trait-impl-72340.rs delete mode 100644 tests/rustdoc/issue-56822.rs delete mode 100644 tests/rustdoc/issue-57180.rs delete mode 100644 tests/rustdoc/issue-60482.rs delete mode 100644 tests/rustdoc/issue-60522-duplicated-glob-reexport.rs delete mode 100644 tests/rustdoc/issue-60726.rs delete mode 100644 tests/rustdoc/issue-61592.rs delete mode 100644 tests/rustdoc/issue-67851-both.rs delete mode 100644 tests/rustdoc/issue-67851-hidden.rs delete mode 100644 tests/rustdoc/issue-67851-neither.rs delete mode 100644 tests/rustdoc/issue-67851-private.rs delete mode 100644 tests/rustdoc/issue-72340.rs delete mode 100644 tests/rustdoc/issue-74083.rs delete mode 100644 tests/rustdoc/issue-75588.rs delete mode 100644 tests/rustdoc/issue-76501.rs delete mode 100644 tests/rustdoc/issue-78673.rs delete mode 100644 tests/rustdoc/issue-78701.rs delete mode 100644 tests/rustdoc/issue-79201.rs create mode 100644 tests/rustdoc/markdown-60482.rs create mode 100644 tests/rustdoc/send-impl-conditional-60726.rs create mode 100644 tests/rustdoc/sidebar-trait-impl-disambiguate-78701.rs create mode 100644 tests/rustdoc/underscore-import-61592.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/auto-trait-lifetimes-56822.rs b/tests/rustdoc/auto-trait-lifetimes-56822.rs new file mode 100644 index 00000000000..315b20ddd70 --- /dev/null +++ b/tests/rustdoc/auto-trait-lifetimes-56822.rs @@ -0,0 +1,27 @@ +// https://github.com/rust-lang/rust/issues/56822 +#![crate_name="foo"] + +struct Wrapper(T); + +trait MyTrait { + type Output; +} + +impl<'a, I, T: 'a> MyTrait for Wrapper + where I: MyTrait +{ + type Output = T; +} + +struct Inner<'a, T>(&'a T); + +impl<'a, T> MyTrait for Inner<'a, T> { + type Output = &'a T; +} + +// @has foo/struct.Parser.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl<'a> Send for Parser<'a>" +pub struct Parser<'a> { + field: > as MyTrait>::Output +} diff --git a/tests/rustdoc/blanket-impl-78673.rs b/tests/rustdoc/blanket-impl-78673.rs new file mode 100644 index 00000000000..d7ceef2c057 --- /dev/null +++ b/tests/rustdoc/blanket-impl-78673.rs @@ -0,0 +1,25 @@ +// https://github.com/rust-lang/rust/issues/78673 +#![crate_name = "issue_78673"] + +pub trait Something {} + +pub trait AnAmazingTrait {} + +impl AnAmazingTrait for T {} + +// @has 'issue_78673/struct.MyStruct.html' +// @has - '//*[@class="impl"]' 'AnAmazingTrait for MyStruct' +// @!has - '//*[@class="impl"]' 'AnAmazingTrait for T' +pub struct MyStruct; + +impl AnAmazingTrait for MyStruct {} + +// generic structs may have _both_ specific and blanket impls that apply + +// @has 'issue_78673/struct.AnotherStruct.html' +// @has - '//*[@class="impl"]' 'AnAmazingTrait for AnotherStruct<()>' +// @has - '//*[@class="impl"]' 'AnAmazingTrait for T' +pub struct AnotherStruct(T); + +impl Something for AnotherStruct {} +impl AnAmazingTrait for AnotherStruct<()> {} diff --git a/tests/rustdoc/const-fn-76501.rs b/tests/rustdoc/const-fn-76501.rs new file mode 100644 index 00000000000..4a7284f9851 --- /dev/null +++ b/tests/rustdoc/const-fn-76501.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/76501 +#![crate_name="foo"] + +// @has 'foo/fn.bloop.html' '//pre' 'pub const fn bloop() -> i32' +/// A useless function that always returns 1. +pub const fn bloop() -> i32 { + 1 +} + +/// A struct. +pub struct Struct {} + +impl Struct { + // @has 'foo/struct.Struct.html' '//*[@class="method"]' \ + // 'pub const fn blurp() -> i32' + /// A useless function that always returns 1. + pub const fn blurp() -> i32 { + 1 + } +} diff --git a/tests/rustdoc/doc-cfg-inherit-from-module-79201.rs b/tests/rustdoc/doc-cfg-inherit-from-module-79201.rs new file mode 100644 index 00000000000..76260c4a502 --- /dev/null +++ b/tests/rustdoc/doc-cfg-inherit-from-module-79201.rs @@ -0,0 +1,44 @@ +// https://github.com/rust-lang/rust/issues/79201 +#![crate_name="foo"] + +#![feature(doc_cfg)] + +// @has 'foo/trait.Foo.html' +// @count - '//*[@class="stab portability"]' 6 +// @matches - '//*[@class="stab portability"]' 'crate feature foo-root' +// @matches - '//*[@class="stab portability"]' 'crate feature foo-public-mod' +// @matches - '//*[@class="stab portability"]' 'crate feature foo-private-mod' +// @matches - '//*[@class="stab portability"]' 'crate feature foo-fn' +// @matches - '//*[@class="stab portability"]' 'crate feature foo-method' + +pub trait Foo {} + +#[doc(cfg(feature = "foo-root"))] +impl crate::Foo for usize {} + +#[doc(cfg(feature = "foo-public-mod"))] +pub mod public { + impl crate::Foo for u8 {} +} + +#[doc(cfg(feature = "foo-private-mod"))] +mod private { + impl crate::Foo for u16 {} +} + +#[doc(cfg(feature = "foo-const"))] +const _: () = { + impl crate::Foo for u32 {} +}; + +#[doc(cfg(feature = "foo-fn"))] +fn __() { + impl crate::Foo for u64 {} +} + +#[doc(cfg(feature = "foo-method"))] +impl dyn Foo { + fn __() { + impl crate::Foo for u128 {} + } +} diff --git a/tests/rustdoc/doc-hidden-private-67851-both.rs b/tests/rustdoc/doc-hidden-private-67851-both.rs new file mode 100644 index 00000000000..e6eb6a68ffd --- /dev/null +++ b/tests/rustdoc/doc-hidden-private-67851-both.rs @@ -0,0 +1,10 @@ +//@ compile-flags: -Zunstable-options --document-private-items --document-hidden-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +// @has foo/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; + +// @has foo/struct.Private.html +struct Private; diff --git a/tests/rustdoc/doc-hidden-private-67851-hidden.rs b/tests/rustdoc/doc-hidden-private-67851-hidden.rs new file mode 100644 index 00000000000..9767f9c84f9 --- /dev/null +++ b/tests/rustdoc/doc-hidden-private-67851-hidden.rs @@ -0,0 +1,10 @@ +//@ compile-flags: -Zunstable-options --document-hidden-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +// @has foo/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; + +// @!has foo/struct.Private.html +struct Private; diff --git a/tests/rustdoc/doc-hidden-private-67851-neither.rs b/tests/rustdoc/doc-hidden-private-67851-neither.rs new file mode 100644 index 00000000000..6c6e84da43d --- /dev/null +++ b/tests/rustdoc/doc-hidden-private-67851-neither.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +// @!has foo/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; + +// @!has foo/struct.Private.html +struct Private; diff --git a/tests/rustdoc/doc-hidden-private-67851-private.rs b/tests/rustdoc/doc-hidden-private-67851-private.rs new file mode 100644 index 00000000000..4aa39f5b789 --- /dev/null +++ b/tests/rustdoc/doc-hidden-private-67851-private.rs @@ -0,0 +1,10 @@ +//@ compile-flags: --document-private-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +// @!has foo/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; + +// @has foo/struct.Private.html +struct Private; diff --git a/tests/rustdoc/duplicated-glob-reexport-60522.rs b/tests/rustdoc/duplicated-glob-reexport-60522.rs new file mode 100644 index 00000000000..50def2c3cd9 --- /dev/null +++ b/tests/rustdoc/duplicated-glob-reexport-60522.rs @@ -0,0 +1,39 @@ +// Regression test for . +// This test ensures that the `banana` and `peach` modules don't appear twice +// and that the visible modules are not the re-exported ones. + +#![crate_name = "foo"] + +// @has 'foo/index.html' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 1 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Modules' +// @count - '//*[@id="main-content"]/*[@class="item-table"]//*[@class="mod"]' 2 +// @has - '//*[@id="main-content"]//*[@class="mod"]' 'banana' +// @has - '//*[@id="main-content"]//*[@href="banana/index.html"]' 'banana' +// @has - '//*[@id="main-content"]//*[@class="mod"]' 'peach' +// @has - '//*[@id="main-content"]//*[@href="peach/index.html"]' 'peach' + +pub use crate::my_crate::*; + +mod my_crate { + pub mod banana { + pub struct Yellow; + } + pub mod peach { + pub struct Pink; + } +} + +// @has 'foo/banana/index.html' +// @count - '//*[@id="main-content"]//*[@class="struct"]' 1 +// @has - '//*[@id="main-content"]//*[@class="struct"]' 'Brown' +pub mod banana { + pub struct Brown; +} + +// @has 'foo/peach/index.html' +// @count - '//*[@id="main-content"]//*[@class="struct"]' 1 +// @has - '//*[@id="main-content"]//*[@class="struct"]' 'Pungent' +pub mod peach { + pub struct Pungent; +} diff --git a/tests/rustdoc/hide-mut-methods-if-no-derefmut-impl-74083.rs b/tests/rustdoc/hide-mut-methods-if-no-derefmut-impl-74083.rs new file mode 100644 index 00000000000..0bed7e2fb62 --- /dev/null +++ b/tests/rustdoc/hide-mut-methods-if-no-derefmut-impl-74083.rs @@ -0,0 +1,24 @@ +// https://github.com/rust-lang/rust/issues/74083 +#![crate_name="foo"] + +use std::ops::Deref; + +pub struct Foo; + +impl Foo { + pub fn foo(&mut self) {} +} + +// @has foo/struct.Bar.html +// @!has - '//div[@class="sidebar-links"]/a[@href="#method.foo"]' 'foo' +pub struct Bar { + foo: Foo, +} + +impl Deref for Bar { + type Target = Foo; + + fn deref(&self) -> &Foo { + &self.foo + } +} diff --git a/tests/rustdoc/ice-import-crate-57180.rs b/tests/rustdoc/ice-import-crate-57180.rs new file mode 100644 index 00000000000..264b53cbd9a --- /dev/null +++ b/tests/rustdoc/ice-import-crate-57180.rs @@ -0,0 +1,8 @@ +//@ aux-build:issue-57180.rs +// https://github.com/rust-lang/rust/issues/57180 + +extern crate issue_57180; +use issue_57180::Trait; + +fn main() { +} diff --git a/tests/rustdoc/implementors-unstable-75588.rs b/tests/rustdoc/implementors-unstable-75588.rs new file mode 100644 index 00000000000..befddf6b788 --- /dev/null +++ b/tests/rustdoc/implementors-unstable-75588.rs @@ -0,0 +1,18 @@ +//@ aux-build:realcore.rs +//@ aux-build:real_gimli.rs + +// Ensure unstably exported traits have their Implementors sections. +// https://github.com/rust-lang/rust/issues/75588 + +#![crate_name = "foo"] +#![feature(extremely_unstable_foo)] + +extern crate realcore; +extern crate real_gimli; + +// issue #74672 +// @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//h3[@class="code-header"]' 'impl Deref for EndianSlice' +pub use realcore::Deref; + +// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//h3[@class="code-header"]' 'impl Join for Foo' +pub use realcore::Join; diff --git a/tests/rustdoc/intra-doc-link-method-trait-impl-72340.rs b/tests/rustdoc/intra-doc-link-method-trait-impl-72340.rs new file mode 100644 index 00000000000..880a308f9ab --- /dev/null +++ b/tests/rustdoc/intra-doc-link-method-trait-impl-72340.rs @@ -0,0 +1,21 @@ +// https://github.com/rust-lang/rust/issues/72340 + +#![crate_name = "foo"] + +pub struct Body; + +impl Body { + pub fn empty() -> Self { + Body + } + +} + +impl Default for Body { + // @has foo/struct.Body.html '//a/@href' 'struct.Body.html#method.empty' + + /// Returns [`Body::empty()`](Body::empty). + fn default() -> Body { + Body::empty() + } +} diff --git a/tests/rustdoc/issue-56822.rs b/tests/rustdoc/issue-56822.rs deleted file mode 100644 index 315b20ddd70..00000000000 --- a/tests/rustdoc/issue-56822.rs +++ /dev/null @@ -1,27 +0,0 @@ -// https://github.com/rust-lang/rust/issues/56822 -#![crate_name="foo"] - -struct Wrapper(T); - -trait MyTrait { - type Output; -} - -impl<'a, I, T: 'a> MyTrait for Wrapper - where I: MyTrait -{ - type Output = T; -} - -struct Inner<'a, T>(&'a T); - -impl<'a, T> MyTrait for Inner<'a, T> { - type Output = &'a T; -} - -// @has foo/struct.Parser.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<'a> Send for Parser<'a>" -pub struct Parser<'a> { - field: > as MyTrait>::Output -} diff --git a/tests/rustdoc/issue-57180.rs b/tests/rustdoc/issue-57180.rs deleted file mode 100644 index 264b53cbd9a..00000000000 --- a/tests/rustdoc/issue-57180.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ aux-build:issue-57180.rs -// https://github.com/rust-lang/rust/issues/57180 - -extern crate issue_57180; -use issue_57180::Trait; - -fn main() { -} diff --git a/tests/rustdoc/issue-60482.rs b/tests/rustdoc/issue-60482.rs deleted file mode 100644 index e40af12e022..00000000000 --- a/tests/rustdoc/issue-60482.rs +++ /dev/null @@ -1,10 +0,0 @@ -// This code caused a panic in `pulldown-cmark` 0.4.1. -// https://github.com/rust-lang/rust/issues/60482 - -pub const BASIC_UNICODE: bool = true; - - -/// # `BASIC_UNICODE`: `A` `|` -/// ```text -/// ``` -pub const BASIC_FONTS: bool = true; diff --git a/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs b/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs deleted file mode 100644 index 50def2c3cd9..00000000000 --- a/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Regression test for . -// This test ensures that the `banana` and `peach` modules don't appear twice -// and that the visible modules are not the re-exported ones. - -#![crate_name = "foo"] - -// @has 'foo/index.html' -// @count - '//*[@id="main-content"]/*[@class="section-header"]' 1 -// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Modules' -// @count - '//*[@id="main-content"]/*[@class="item-table"]//*[@class="mod"]' 2 -// @has - '//*[@id="main-content"]//*[@class="mod"]' 'banana' -// @has - '//*[@id="main-content"]//*[@href="banana/index.html"]' 'banana' -// @has - '//*[@id="main-content"]//*[@class="mod"]' 'peach' -// @has - '//*[@id="main-content"]//*[@href="peach/index.html"]' 'peach' - -pub use crate::my_crate::*; - -mod my_crate { - pub mod banana { - pub struct Yellow; - } - pub mod peach { - pub struct Pink; - } -} - -// @has 'foo/banana/index.html' -// @count - '//*[@id="main-content"]//*[@class="struct"]' 1 -// @has - '//*[@id="main-content"]//*[@class="struct"]' 'Brown' -pub mod banana { - pub struct Brown; -} - -// @has 'foo/peach/index.html' -// @count - '//*[@id="main-content"]//*[@class="struct"]' 1 -// @has - '//*[@id="main-content"]//*[@class="struct"]' 'Pungent' -pub mod peach { - pub struct Pungent; -} diff --git a/tests/rustdoc/issue-60726.rs b/tests/rustdoc/issue-60726.rs deleted file mode 100644 index ea10aee58e4..00000000000 --- a/tests/rustdoc/issue-60726.rs +++ /dev/null @@ -1,38 +0,0 @@ -// https://github.com/rust-lang/rust/issues/60726 -#![crate_name="foo"] - -use std::marker::PhantomData; - -pub struct True; -pub struct False; - -pub trait InterfaceType{ - type Send; -} - - -pub struct FooInterface(PhantomDataT>); - -impl InterfaceType for FooInterface { - type Send=False; -} - - -pub struct DynTrait{ - _interface:PhantomDataI>, - _unsync_unsend:PhantomData<::std::rc::Rc<()>>, -} - -unsafe impl Send for DynTrait -where - I:InterfaceType -{} - -// @has foo/struct.IntoIter.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl !Send for IntoIter" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl !Sync for IntoIter" -pub struct IntoIter{ - hello:DynTrait>, -} diff --git a/tests/rustdoc/issue-61592.rs b/tests/rustdoc/issue-61592.rs deleted file mode 100644 index d403f2cc7ab..00000000000 --- a/tests/rustdoc/issue-61592.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ aux-build:issue-61592.rs -// https://github.com/rust-lang/rust/issues/61592 -#![crate_name="bar"] - -extern crate foo; - -// @has bar/index.html -// @has - '//a[@href="#reexports"]' 'Re-exports' -// @has - '//code' 'pub use foo::FooTrait as _;' -// @!has - '//a[@href="trait._.html"]' '' -pub use foo::FooTrait as _; - -// @has bar/index.html -// @has - '//a[@href="#reexports"]' 'Re-exports' -// @has - '//code' 'pub use foo::FooStruct as _;' -// @!has - '//a[@href="struct._.html"]' '' -pub use foo::FooStruct as _; diff --git a/tests/rustdoc/issue-67851-both.rs b/tests/rustdoc/issue-67851-both.rs deleted file mode 100644 index e6eb6a68ffd..00000000000 --- a/tests/rustdoc/issue-67851-both.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ compile-flags: -Zunstable-options --document-private-items --document-hidden-items -// https://github.com/rust-lang/rust/issues/67851 -#![crate_name="foo"] - -// @has foo/struct.Hidden.html -#[doc(hidden)] -pub struct Hidden; - -// @has foo/struct.Private.html -struct Private; diff --git a/tests/rustdoc/issue-67851-hidden.rs b/tests/rustdoc/issue-67851-hidden.rs deleted file mode 100644 index 9767f9c84f9..00000000000 --- a/tests/rustdoc/issue-67851-hidden.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ compile-flags: -Zunstable-options --document-hidden-items -// https://github.com/rust-lang/rust/issues/67851 -#![crate_name="foo"] - -// @has foo/struct.Hidden.html -#[doc(hidden)] -pub struct Hidden; - -// @!has foo/struct.Private.html -struct Private; diff --git a/tests/rustdoc/issue-67851-neither.rs b/tests/rustdoc/issue-67851-neither.rs deleted file mode 100644 index 6c6e84da43d..00000000000 --- a/tests/rustdoc/issue-67851-neither.rs +++ /dev/null @@ -1,9 +0,0 @@ -// https://github.com/rust-lang/rust/issues/67851 -#![crate_name="foo"] - -// @!has foo/struct.Hidden.html -#[doc(hidden)] -pub struct Hidden; - -// @!has foo/struct.Private.html -struct Private; diff --git a/tests/rustdoc/issue-67851-private.rs b/tests/rustdoc/issue-67851-private.rs deleted file mode 100644 index 4aa39f5b789..00000000000 --- a/tests/rustdoc/issue-67851-private.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ compile-flags: --document-private-items -// https://github.com/rust-lang/rust/issues/67851 -#![crate_name="foo"] - -// @!has foo/struct.Hidden.html -#[doc(hidden)] -pub struct Hidden; - -// @has foo/struct.Private.html -struct Private; diff --git a/tests/rustdoc/issue-72340.rs b/tests/rustdoc/issue-72340.rs deleted file mode 100644 index 880a308f9ab..00000000000 --- a/tests/rustdoc/issue-72340.rs +++ /dev/null @@ -1,21 +0,0 @@ -// https://github.com/rust-lang/rust/issues/72340 - -#![crate_name = "foo"] - -pub struct Body; - -impl Body { - pub fn empty() -> Self { - Body - } - -} - -impl Default for Body { - // @has foo/struct.Body.html '//a/@href' 'struct.Body.html#method.empty' - - /// Returns [`Body::empty()`](Body::empty). - fn default() -> Body { - Body::empty() - } -} diff --git a/tests/rustdoc/issue-74083.rs b/tests/rustdoc/issue-74083.rs deleted file mode 100644 index 0bed7e2fb62..00000000000 --- a/tests/rustdoc/issue-74083.rs +++ /dev/null @@ -1,24 +0,0 @@ -// https://github.com/rust-lang/rust/issues/74083 -#![crate_name="foo"] - -use std::ops::Deref; - -pub struct Foo; - -impl Foo { - pub fn foo(&mut self) {} -} - -// @has foo/struct.Bar.html -// @!has - '//div[@class="sidebar-links"]/a[@href="#method.foo"]' 'foo' -pub struct Bar { - foo: Foo, -} - -impl Deref for Bar { - type Target = Foo; - - fn deref(&self) -> &Foo { - &self.foo - } -} diff --git a/tests/rustdoc/issue-75588.rs b/tests/rustdoc/issue-75588.rs deleted file mode 100644 index befddf6b788..00000000000 --- a/tests/rustdoc/issue-75588.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@ aux-build:realcore.rs -//@ aux-build:real_gimli.rs - -// Ensure unstably exported traits have their Implementors sections. -// https://github.com/rust-lang/rust/issues/75588 - -#![crate_name = "foo"] -#![feature(extremely_unstable_foo)] - -extern crate realcore; -extern crate real_gimli; - -// issue #74672 -// @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//h3[@class="code-header"]' 'impl Deref for EndianSlice' -pub use realcore::Deref; - -// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//h3[@class="code-header"]' 'impl Join for Foo' -pub use realcore::Join; diff --git a/tests/rustdoc/issue-76501.rs b/tests/rustdoc/issue-76501.rs deleted file mode 100644 index 4a7284f9851..00000000000 --- a/tests/rustdoc/issue-76501.rs +++ /dev/null @@ -1,20 +0,0 @@ -// https://github.com/rust-lang/rust/issues/76501 -#![crate_name="foo"] - -// @has 'foo/fn.bloop.html' '//pre' 'pub const fn bloop() -> i32' -/// A useless function that always returns 1. -pub const fn bloop() -> i32 { - 1 -} - -/// A struct. -pub struct Struct {} - -impl Struct { - // @has 'foo/struct.Struct.html' '//*[@class="method"]' \ - // 'pub const fn blurp() -> i32' - /// A useless function that always returns 1. - pub const fn blurp() -> i32 { - 1 - } -} diff --git a/tests/rustdoc/issue-78673.rs b/tests/rustdoc/issue-78673.rs deleted file mode 100644 index d7ceef2c057..00000000000 --- a/tests/rustdoc/issue-78673.rs +++ /dev/null @@ -1,25 +0,0 @@ -// https://github.com/rust-lang/rust/issues/78673 -#![crate_name = "issue_78673"] - -pub trait Something {} - -pub trait AnAmazingTrait {} - -impl AnAmazingTrait for T {} - -// @has 'issue_78673/struct.MyStruct.html' -// @has - '//*[@class="impl"]' 'AnAmazingTrait for MyStruct' -// @!has - '//*[@class="impl"]' 'AnAmazingTrait for T' -pub struct MyStruct; - -impl AnAmazingTrait for MyStruct {} - -// generic structs may have _both_ specific and blanket impls that apply - -// @has 'issue_78673/struct.AnotherStruct.html' -// @has - '//*[@class="impl"]' 'AnAmazingTrait for AnotherStruct<()>' -// @has - '//*[@class="impl"]' 'AnAmazingTrait for T' -pub struct AnotherStruct(T); - -impl Something for AnotherStruct {} -impl AnAmazingTrait for AnotherStruct<()> {} diff --git a/tests/rustdoc/issue-78701.rs b/tests/rustdoc/issue-78701.rs deleted file mode 100644 index 89b7ccb5222..00000000000 --- a/tests/rustdoc/issue-78701.rs +++ /dev/null @@ -1,21 +0,0 @@ -// https://github.com/rust-lang/rust/issues/78701 -#![crate_name = "foo"] - -// This test ensures that if a blanket impl has the same ID as another impl, it'll -// link to the blanket impl and not the other impl. Basically, we're checking if -// the ID is correctly derived. - -// @has 'foo/struct.AnotherStruct.html' -// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3C()%3E"]' 1 -// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-T"]' 1 - -pub trait Something {} - -pub trait AnAmazingTrait {} - -impl AnAmazingTrait for T {} - -pub struct AnotherStruct(T); - -impl Something for AnotherStruct {} -impl AnAmazingTrait for AnotherStruct<()> {} diff --git a/tests/rustdoc/issue-79201.rs b/tests/rustdoc/issue-79201.rs deleted file mode 100644 index 76260c4a502..00000000000 --- a/tests/rustdoc/issue-79201.rs +++ /dev/null @@ -1,44 +0,0 @@ -// https://github.com/rust-lang/rust/issues/79201 -#![crate_name="foo"] - -#![feature(doc_cfg)] - -// @has 'foo/trait.Foo.html' -// @count - '//*[@class="stab portability"]' 6 -// @matches - '//*[@class="stab portability"]' 'crate feature foo-root' -// @matches - '//*[@class="stab portability"]' 'crate feature foo-public-mod' -// @matches - '//*[@class="stab portability"]' 'crate feature foo-private-mod' -// @matches - '//*[@class="stab portability"]' 'crate feature foo-fn' -// @matches - '//*[@class="stab portability"]' 'crate feature foo-method' - -pub trait Foo {} - -#[doc(cfg(feature = "foo-root"))] -impl crate::Foo for usize {} - -#[doc(cfg(feature = "foo-public-mod"))] -pub mod public { - impl crate::Foo for u8 {} -} - -#[doc(cfg(feature = "foo-private-mod"))] -mod private { - impl crate::Foo for u16 {} -} - -#[doc(cfg(feature = "foo-const"))] -const _: () = { - impl crate::Foo for u32 {} -}; - -#[doc(cfg(feature = "foo-fn"))] -fn __() { - impl crate::Foo for u64 {} -} - -#[doc(cfg(feature = "foo-method"))] -impl dyn Foo { - fn __() { - impl crate::Foo for u128 {} - } -} diff --git a/tests/rustdoc/markdown-60482.rs b/tests/rustdoc/markdown-60482.rs new file mode 100644 index 00000000000..e40af12e022 --- /dev/null +++ b/tests/rustdoc/markdown-60482.rs @@ -0,0 +1,10 @@ +// This code caused a panic in `pulldown-cmark` 0.4.1. +// https://github.com/rust-lang/rust/issues/60482 + +pub const BASIC_UNICODE: bool = true; + + +/// # `BASIC_UNICODE`: `A` `|` +/// ```text +/// ``` +pub const BASIC_FONTS: bool = true; diff --git a/tests/rustdoc/send-impl-conditional-60726.rs b/tests/rustdoc/send-impl-conditional-60726.rs new file mode 100644 index 00000000000..ea10aee58e4 --- /dev/null +++ b/tests/rustdoc/send-impl-conditional-60726.rs @@ -0,0 +1,38 @@ +// https://github.com/rust-lang/rust/issues/60726 +#![crate_name="foo"] + +use std::marker::PhantomData; + +pub struct True; +pub struct False; + +pub trait InterfaceType{ + type Send; +} + + +pub struct FooInterface(PhantomDataT>); + +impl InterfaceType for FooInterface { + type Send=False; +} + + +pub struct DynTrait{ + _interface:PhantomDataI>, + _unsync_unsend:PhantomData<::std::rc::Rc<()>>, +} + +unsafe impl Send for DynTrait +where + I:InterfaceType +{} + +// @has foo/struct.IntoIter.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl !Send for IntoIter" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl !Sync for IntoIter" +pub struct IntoIter{ + hello:DynTrait>, +} diff --git a/tests/rustdoc/sidebar-trait-impl-disambiguate-78701.rs b/tests/rustdoc/sidebar-trait-impl-disambiguate-78701.rs new file mode 100644 index 00000000000..89b7ccb5222 --- /dev/null +++ b/tests/rustdoc/sidebar-trait-impl-disambiguate-78701.rs @@ -0,0 +1,21 @@ +// https://github.com/rust-lang/rust/issues/78701 +#![crate_name = "foo"] + +// This test ensures that if a blanket impl has the same ID as another impl, it'll +// link to the blanket impl and not the other impl. Basically, we're checking if +// the ID is correctly derived. + +// @has 'foo/struct.AnotherStruct.html' +// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3C()%3E"]' 1 +// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-T"]' 1 + +pub trait Something {} + +pub trait AnAmazingTrait {} + +impl AnAmazingTrait for T {} + +pub struct AnotherStruct(T); + +impl Something for AnotherStruct {} +impl AnAmazingTrait for AnotherStruct<()> {} diff --git a/tests/rustdoc/underscore-import-61592.rs b/tests/rustdoc/underscore-import-61592.rs new file mode 100644 index 00000000000..d403f2cc7ab --- /dev/null +++ b/tests/rustdoc/underscore-import-61592.rs @@ -0,0 +1,17 @@ +//@ aux-build:issue-61592.rs +// https://github.com/rust-lang/rust/issues/61592 +#![crate_name="bar"] + +extern crate foo; + +// @has bar/index.html +// @has - '//a[@href="#reexports"]' 'Re-exports' +// @has - '//code' 'pub use foo::FooTrait as _;' +// @!has - '//a[@href="trait._.html"]' '' +pub use foo::FooTrait as _; + +// @has bar/index.html +// @has - '//a[@href="#reexports"]' 'Re-exports' +// @has - '//code' 'pub use foo::FooStruct as _;' +// @!has - '//a[@href="struct._.html"]' '' +pub use foo::FooStruct as _; -- cgit 1.4.1-3-g733a5 From ecbe327e71f71eeb069fba8919391471f18a573e Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 15 Apr 2024 13:49:50 -0700 Subject: rustdoc: move tests into applicable subdirectories --- tests/rustdoc/auto-trait-lifetimes-56822.rs | 27 --------------- tests/rustdoc/auxiliary/issue-57180.rs | 16 --------- tests/rustdoc/ice-import-crate-57180.rs | 8 ----- .../rustdoc/inline_cross/auxiliary/issue-57180.rs | 16 +++++++++ .../rustdoc/inline_cross/ice-import-crate-57180.rs | 8 +++++ tests/rustdoc/send-impl-conditional-60726.rs | 38 ---------------------- .../synthetic_auto/auto-trait-lifetimes-56822.rs | 27 +++++++++++++++ .../synthetic_auto/send-impl-conditional-60726.rs | 38 ++++++++++++++++++++++ 8 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 tests/rustdoc/auto-trait-lifetimes-56822.rs delete mode 100644 tests/rustdoc/auxiliary/issue-57180.rs delete mode 100644 tests/rustdoc/ice-import-crate-57180.rs create mode 100644 tests/rustdoc/inline_cross/auxiliary/issue-57180.rs create mode 100644 tests/rustdoc/inline_cross/ice-import-crate-57180.rs delete mode 100644 tests/rustdoc/send-impl-conditional-60726.rs create mode 100644 tests/rustdoc/synthetic_auto/auto-trait-lifetimes-56822.rs create mode 100644 tests/rustdoc/synthetic_auto/send-impl-conditional-60726.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/auto-trait-lifetimes-56822.rs b/tests/rustdoc/auto-trait-lifetimes-56822.rs deleted file mode 100644 index 315b20ddd70..00000000000 --- a/tests/rustdoc/auto-trait-lifetimes-56822.rs +++ /dev/null @@ -1,27 +0,0 @@ -// https://github.com/rust-lang/rust/issues/56822 -#![crate_name="foo"] - -struct Wrapper(T); - -trait MyTrait { - type Output; -} - -impl<'a, I, T: 'a> MyTrait for Wrapper - where I: MyTrait -{ - type Output = T; -} - -struct Inner<'a, T>(&'a T); - -impl<'a, T> MyTrait for Inner<'a, T> { - type Output = &'a T; -} - -// @has foo/struct.Parser.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<'a> Send for Parser<'a>" -pub struct Parser<'a> { - field: > as MyTrait>::Output -} diff --git a/tests/rustdoc/auxiliary/issue-57180.rs b/tests/rustdoc/auxiliary/issue-57180.rs deleted file mode 100644 index cd905b7a598..00000000000 --- a/tests/rustdoc/auxiliary/issue-57180.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ compile-flags: -Cmetadata=aux - -pub trait Trait { -} - -pub struct Struct -{ - _p: ::std::marker::PhantomData, -} - -impl u32> -Trait for Struct - where - F: Fn() -> u32, -{ -} diff --git a/tests/rustdoc/ice-import-crate-57180.rs b/tests/rustdoc/ice-import-crate-57180.rs deleted file mode 100644 index 264b53cbd9a..00000000000 --- a/tests/rustdoc/ice-import-crate-57180.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ aux-build:issue-57180.rs -// https://github.com/rust-lang/rust/issues/57180 - -extern crate issue_57180; -use issue_57180::Trait; - -fn main() { -} diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-57180.rs b/tests/rustdoc/inline_cross/auxiliary/issue-57180.rs new file mode 100644 index 00000000000..cd905b7a598 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/issue-57180.rs @@ -0,0 +1,16 @@ +//@ compile-flags: -Cmetadata=aux + +pub trait Trait { +} + +pub struct Struct +{ + _p: ::std::marker::PhantomData, +} + +impl u32> +Trait for Struct + where + F: Fn() -> u32, +{ +} diff --git a/tests/rustdoc/inline_cross/ice-import-crate-57180.rs b/tests/rustdoc/inline_cross/ice-import-crate-57180.rs new file mode 100644 index 00000000000..264b53cbd9a --- /dev/null +++ b/tests/rustdoc/inline_cross/ice-import-crate-57180.rs @@ -0,0 +1,8 @@ +//@ aux-build:issue-57180.rs +// https://github.com/rust-lang/rust/issues/57180 + +extern crate issue_57180; +use issue_57180::Trait; + +fn main() { +} diff --git a/tests/rustdoc/send-impl-conditional-60726.rs b/tests/rustdoc/send-impl-conditional-60726.rs deleted file mode 100644 index ea10aee58e4..00000000000 --- a/tests/rustdoc/send-impl-conditional-60726.rs +++ /dev/null @@ -1,38 +0,0 @@ -// https://github.com/rust-lang/rust/issues/60726 -#![crate_name="foo"] - -use std::marker::PhantomData; - -pub struct True; -pub struct False; - -pub trait InterfaceType{ - type Send; -} - - -pub struct FooInterface(PhantomDataT>); - -impl InterfaceType for FooInterface { - type Send=False; -} - - -pub struct DynTrait{ - _interface:PhantomDataI>, - _unsync_unsend:PhantomData<::std::rc::Rc<()>>, -} - -unsafe impl Send for DynTrait -where - I:InterfaceType -{} - -// @has foo/struct.IntoIter.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl !Send for IntoIter" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl !Sync for IntoIter" -pub struct IntoIter{ - hello:DynTrait>, -} diff --git a/tests/rustdoc/synthetic_auto/auto-trait-lifetimes-56822.rs b/tests/rustdoc/synthetic_auto/auto-trait-lifetimes-56822.rs new file mode 100644 index 00000000000..315b20ddd70 --- /dev/null +++ b/tests/rustdoc/synthetic_auto/auto-trait-lifetimes-56822.rs @@ -0,0 +1,27 @@ +// https://github.com/rust-lang/rust/issues/56822 +#![crate_name="foo"] + +struct Wrapper(T); + +trait MyTrait { + type Output; +} + +impl<'a, I, T: 'a> MyTrait for Wrapper + where I: MyTrait +{ + type Output = T; +} + +struct Inner<'a, T>(&'a T); + +impl<'a, T> MyTrait for Inner<'a, T> { + type Output = &'a T; +} + +// @has foo/struct.Parser.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl<'a> Send for Parser<'a>" +pub struct Parser<'a> { + field: > as MyTrait>::Output +} diff --git a/tests/rustdoc/synthetic_auto/send-impl-conditional-60726.rs b/tests/rustdoc/synthetic_auto/send-impl-conditional-60726.rs new file mode 100644 index 00000000000..ea10aee58e4 --- /dev/null +++ b/tests/rustdoc/synthetic_auto/send-impl-conditional-60726.rs @@ -0,0 +1,38 @@ +// https://github.com/rust-lang/rust/issues/60726 +#![crate_name="foo"] + +use std::marker::PhantomData; + +pub struct True; +pub struct False; + +pub trait InterfaceType{ + type Send; +} + + +pub struct FooInterface(PhantomDataT>); + +impl InterfaceType for FooInterface { + type Send=False; +} + + +pub struct DynTrait{ + _interface:PhantomDataI>, + _unsync_unsend:PhantomData<::std::rc::Rc<()>>, +} + +unsafe impl Send for DynTrait +where + I:InterfaceType +{} + +// @has foo/struct.IntoIter.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl !Send for IntoIter" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl !Sync for IntoIter" +pub struct IntoIter{ + hello:DynTrait>, +} -- cgit 1.4.1-3-g733a5