From e02c5b5930c2c9ba3e5423fe12e2ef0155017297 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:36 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/rustdoc/anchor-id-trait-method-15169.rs | 7 ++ tests/rustdoc/assoc-type-bindings-20646.rs | 28 +++++ .../auxiliary/cross_crate_generic_typedef.rs | 5 + tests/rustdoc/const-effect-param.rs | 12 +++ tests/rustdoc/const-fn-effects.rs | 19 ++++ .../const-generics/const-generic-defaults.rs | 2 +- .../rustdoc/const-generics/const-generics-docs.rs | 4 +- tests/rustdoc/custom_code_classes.rs | 28 +++++ tests/rustdoc/deref-methods-19190-foreign-type.rs | 16 +++ tests/rustdoc/deref-methods-19190-inline.rs | 30 ++++++ tests/rustdoc/deref-methods-19190.rs | 23 ++++ tests/rustdoc/doc-hidden-method-13698.rs | 19 ++++ tests/rustdoc/doc-test-attr-18199.rs | 11 ++ tests/rustdoc/document-hidden-items-15347.rs | 8 ++ tests/rustdoc/highlight-invalid-rust-12834.rs | 14 +++ tests/rustdoc/html-no-source.rs | 30 ++++++ tests/rustdoc/ice-type-error-19181.rs | 6 ++ tests/rustdoc/impl-ref-20175.rs | 14 +++ tests/rustdoc/infinite-redirection-16265-1.rs | 13 +++ tests/rustdoc/infinite-redirection-16265-2.rs | 7 ++ tests/rustdoc/inline-assoc-type-20727-bindings.rs | 25 +++++ .../inline-assoc-type-20727-bounds-deref.rs | 27 +++++ .../inline-assoc-type-20727-bounds-index.rs | 43 ++++++++ tests/rustdoc/inline-assoc-type-20727-bounds.rs | 27 +++++ tests/rustdoc/inline_cross/async-fn.rs | 19 ++++ tests/rustdoc/inline_cross/auxiliary/async-fn.rs | 18 ++++ tests/rustdoc/inline_cross/auxiliary/const-fn.rs | 5 + .../inline_cross/auxiliary/impl_trait_aux.rs | 6 -- tests/rustdoc/inline_cross/const-fn.rs | 10 ++ tests/rustdoc/inline_cross/impl_trait.rs | 8 -- .../rustdoc/issue-105735-overlapping-reexport-2.rs | 2 +- tests/rustdoc/issue-109449-doc-hidden-reexports.rs | 6 +- tests/rustdoc/issue-12834.rs | 12 --- tests/rustdoc/issue-13698.rs | 16 --- tests/rustdoc/issue-15169.rs | 3 - tests/rustdoc/issue-15318-2.rs | 12 --- tests/rustdoc/issue-15318-3.rs | 7 -- tests/rustdoc/issue-15318.rs | 11 -- tests/rustdoc/issue-15347.rs | 5 - tests/rustdoc/issue-16019.rs | 9 -- tests/rustdoc/issue-16265-1.rs | 10 -- tests/rustdoc/issue-16265-2.rs | 4 - tests/rustdoc/issue-17476.rs | 11 -- tests/rustdoc/issue-18199.rs | 10 -- tests/rustdoc/issue-19181.rs | 5 - tests/rustdoc/issue-19190-2.rs | 12 --- tests/rustdoc/issue-19190-3.rs | 27 ----- tests/rustdoc/issue-19190.rs | 20 ---- tests/rustdoc/issue-20175.rs | 10 -- tests/rustdoc/issue-20646.rs | 26 ----- tests/rustdoc/issue-20727-2.rs | 22 ---- tests/rustdoc/issue-20727-3.rs | 24 ----- tests/rustdoc/issue-20727-4.rs | 40 ------- tests/rustdoc/issue-20727.rs | 24 ----- tests/rustdoc/issue-32077-type-alias-impls.rs | 66 ++++++++++++ tests/rustdoc/issue-88600.rs | 4 +- tests/rustdoc/macro-ice-16019.rs | 11 ++ .../method-link-foreign-trait-impl-17476.rs | 14 +++ tests/rustdoc/no-crate-filter.rs | 6 -- tests/rustdoc/primitive-raw-pointer-dox-15318-3.rs | 9 ++ tests/rustdoc/primitive-raw-pointer-link-15318.rs | 13 +++ ...rimitive-raw-pointer-link-no-inlined-15318-2.rs | 15 +++ tests/rustdoc/private-fields-tuple-struct.rs | 15 +++ tests/rustdoc/rfc-2632-const-trait-impl.rs | 22 ++-- tests/rustdoc/show-const-contents.rs | 2 +- tests/rustdoc/sidebar-all-page.rs | 5 +- tests/rustdoc/titles.rs | 2 +- .../typedef-inner-variants-lazy_type_alias.rs | 34 ++++++ tests/rustdoc/typedef-inner-variants.rs | 119 +++++++++++++++++++++ tests/rustdoc/where.SWhere_Simd_item-decl.html | 2 +- tests/rustdoc/where.alpha_trait_decl.html | 2 +- tests/rustdoc/where.rs | 2 +- 72 files changed, 788 insertions(+), 367 deletions(-) create mode 100644 tests/rustdoc/anchor-id-trait-method-15169.rs create mode 100644 tests/rustdoc/assoc-type-bindings-20646.rs create mode 100644 tests/rustdoc/auxiliary/cross_crate_generic_typedef.rs create mode 100644 tests/rustdoc/const-effect-param.rs create mode 100644 tests/rustdoc/const-fn-effects.rs create mode 100644 tests/rustdoc/custom_code_classes.rs create mode 100644 tests/rustdoc/deref-methods-19190-foreign-type.rs create mode 100644 tests/rustdoc/deref-methods-19190-inline.rs create mode 100644 tests/rustdoc/deref-methods-19190.rs create mode 100644 tests/rustdoc/doc-hidden-method-13698.rs create mode 100644 tests/rustdoc/doc-test-attr-18199.rs create mode 100644 tests/rustdoc/document-hidden-items-15347.rs create mode 100644 tests/rustdoc/highlight-invalid-rust-12834.rs create mode 100644 tests/rustdoc/html-no-source.rs create mode 100644 tests/rustdoc/ice-type-error-19181.rs create mode 100644 tests/rustdoc/impl-ref-20175.rs create mode 100644 tests/rustdoc/infinite-redirection-16265-1.rs create mode 100644 tests/rustdoc/infinite-redirection-16265-2.rs create mode 100644 tests/rustdoc/inline-assoc-type-20727-bindings.rs create mode 100644 tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs create mode 100644 tests/rustdoc/inline-assoc-type-20727-bounds-index.rs create mode 100644 tests/rustdoc/inline-assoc-type-20727-bounds.rs create mode 100644 tests/rustdoc/inline_cross/async-fn.rs create mode 100644 tests/rustdoc/inline_cross/auxiliary/async-fn.rs create mode 100644 tests/rustdoc/inline_cross/auxiliary/const-fn.rs create mode 100644 tests/rustdoc/inline_cross/const-fn.rs delete mode 100644 tests/rustdoc/issue-12834.rs delete mode 100644 tests/rustdoc/issue-13698.rs delete mode 100644 tests/rustdoc/issue-15169.rs delete mode 100644 tests/rustdoc/issue-15318-2.rs delete mode 100644 tests/rustdoc/issue-15318-3.rs delete mode 100644 tests/rustdoc/issue-15318.rs delete mode 100644 tests/rustdoc/issue-15347.rs delete mode 100644 tests/rustdoc/issue-16019.rs delete mode 100644 tests/rustdoc/issue-16265-1.rs delete mode 100644 tests/rustdoc/issue-16265-2.rs delete mode 100644 tests/rustdoc/issue-17476.rs delete mode 100644 tests/rustdoc/issue-18199.rs delete mode 100644 tests/rustdoc/issue-19181.rs delete mode 100644 tests/rustdoc/issue-19190-2.rs delete mode 100644 tests/rustdoc/issue-19190-3.rs delete mode 100644 tests/rustdoc/issue-19190.rs delete mode 100644 tests/rustdoc/issue-20175.rs delete mode 100644 tests/rustdoc/issue-20646.rs delete mode 100644 tests/rustdoc/issue-20727-2.rs delete mode 100644 tests/rustdoc/issue-20727-3.rs delete mode 100644 tests/rustdoc/issue-20727-4.rs delete mode 100644 tests/rustdoc/issue-20727.rs create mode 100644 tests/rustdoc/issue-32077-type-alias-impls.rs create mode 100644 tests/rustdoc/macro-ice-16019.rs create mode 100644 tests/rustdoc/method-link-foreign-trait-impl-17476.rs delete mode 100644 tests/rustdoc/no-crate-filter.rs create mode 100644 tests/rustdoc/primitive-raw-pointer-dox-15318-3.rs create mode 100644 tests/rustdoc/primitive-raw-pointer-link-15318.rs create mode 100644 tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs create mode 100644 tests/rustdoc/private-fields-tuple-struct.rs create mode 100644 tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs create mode 100644 tests/rustdoc/typedef-inner-variants.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/anchor-id-trait-method-15169.rs b/tests/rustdoc/anchor-id-trait-method-15169.rs new file mode 100644 index 000000000..26bb59c18 --- /dev/null +++ b/tests/rustdoc/anchor-id-trait-method-15169.rs @@ -0,0 +1,7 @@ +// @has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq' + +// https://github.com/rust-lang/rust/issues/15169 +#![crate_name="issue_15169"] + +#[derive(PartialEq)] +pub struct Foo; diff --git a/tests/rustdoc/assoc-type-bindings-20646.rs b/tests/rustdoc/assoc-type-bindings-20646.rs new file mode 100644 index 000000000..375b5b5b2 --- /dev/null +++ b/tests/rustdoc/assoc-type-bindings-20646.rs @@ -0,0 +1,28 @@ +// aux-build:issue-20646.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/20646 +#![crate_name="issue_20646"] +#![feature(associated_types)] + +extern crate issue_20646; + +// @has issue_20646/trait.Trait.html \ +// '//*[@id="associatedtype.Output"]' \ +// 'type Output' +pub trait Trait { + type Output; +} + +// @has issue_20646/fn.fun.html \ +// '//pre[@class="rust item-decl"]' 'where T: Trait' +pub fn fun(_: T) where T: Trait {} + +pub mod reexport { + // @has issue_20646/reexport/trait.Trait.html \ + // '//*[@id="associatedtype.Output"]' \ + // 'type Output' + // @has issue_20646/reexport/fn.fun.html \ + // '//pre[@class="rust item-decl"]' 'where T: Trait' + pub use issue_20646::{Trait, fun}; +} diff --git a/tests/rustdoc/auxiliary/cross_crate_generic_typedef.rs b/tests/rustdoc/auxiliary/cross_crate_generic_typedef.rs new file mode 100644 index 000000000..f4e020b3b --- /dev/null +++ b/tests/rustdoc/auxiliary/cross_crate_generic_typedef.rs @@ -0,0 +1,5 @@ +pub struct InlineOne { + pub inline: A +} + +pub type InlineU64 = InlineOne; diff --git a/tests/rustdoc/const-effect-param.rs b/tests/rustdoc/const-effect-param.rs new file mode 100644 index 000000000..f50a9b96d --- /dev/null +++ b/tests/rustdoc/const-effect-param.rs @@ -0,0 +1,12 @@ +#![crate_name = "foo"] +#![feature(effects, const_trait_impl)] + +#[const_trait] +pub trait Tr { + fn f(); +} + +// @has foo/fn.g.html +// @has - '//pre[@class="rust item-decl"]' 'pub const fn g()' +/// foo +pub const fn g() {} diff --git a/tests/rustdoc/const-fn-effects.rs b/tests/rustdoc/const-fn-effects.rs new file mode 100644 index 000000000..7c19b4b2c --- /dev/null +++ b/tests/rustdoc/const-fn-effects.rs @@ -0,0 +1,19 @@ +#![crate_name = "foo"] +#![feature(effects)] + +// @has foo/fn.bar.html +// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> ' +/// foo +pub const fn bar() -> usize { + 2 +} + +// @has foo/struct.Foo.html +// @has - '//*[@class="method"]' 'const fn new()' +pub struct Foo(usize); + +impl Foo { + pub const fn new() -> Foo { + Foo(0) + } +} diff --git a/tests/rustdoc/const-generics/const-generic-defaults.rs b/tests/rustdoc/const-generics/const-generic-defaults.rs index f781c6a62..7a0a79411 100644 --- a/tests/rustdoc/const-generics/const-generic-defaults.rs +++ b/tests/rustdoc/const-generics/const-generic-defaults.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \ -// 'pub struct Foo(_);' +// 'pub struct Foo(' pub struct Foo(T); diff --git a/tests/rustdoc/const-generics/const-generics-docs.rs b/tests/rustdoc/const-generics/const-generics-docs.rs index 828486a41..70a9518f0 100644 --- a/tests/rustdoc/const-generics/const-generics-docs.rs +++ b/tests/rustdoc/const-generics/const-generics-docs.rs @@ -33,7 +33,7 @@ impl Trait for [u8; N] {} // @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \ // 'pub struct Foo where u8: Trait' pub struct Foo where u8: Trait; -// @has foo/struct.Bar.html '//pre[@class="rust item-decl"]' 'pub struct Bar(_)' +// @has foo/struct.Bar.html '//pre[@class="rust item-decl"]' 'pub struct Bar(' pub struct Bar([T; N]); // @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header"]' 'impl Foowhere u8: Trait' @@ -92,7 +92,7 @@ macro_rules! define_me { } // @has foo/struct.Foz.html '//pre[@class="rust item-decl"]' \ -// 'pub struct Foz(_);' +// 'pub struct Foz(/* private fields */);' define_me!(Foz); trait Q { diff --git a/tests/rustdoc/custom_code_classes.rs b/tests/rustdoc/custom_code_classes.rs new file mode 100644 index 000000000..cd20d8b7d --- /dev/null +++ b/tests/rustdoc/custom_code_classes.rs @@ -0,0 +1,28 @@ +// Test for `custom_code_classes_in_docs` feature. + +#![feature(custom_code_classes_in_docs)] +#![crate_name = "foo"] +#![feature(no_core)] +#![no_core] + +// @has 'foo/struct.Bar.html' +// @has - '//*[@id="main-content"]//pre[@class="language-whatever hoho-c"]' 'main;' +// @has - '//*[@id="main-content"]//pre[@class="language-whatever2 haha-c"]' 'main;' +// @has - '//*[@id="main-content"]//pre[@class="language-whatever4 huhu-c"]' 'main;' + +/// ```{class=hoho-c},whatever +/// main; +/// ``` +/// +/// Testing multiple kinds of orders. +/// +/// ```whatever2 {class=haha-c} +/// main; +/// ``` +/// +/// Testing with multiple "unknown". Only the first should be used. +/// +/// ```whatever4,{.huhu-c} whatever5 +/// main; +/// ``` +pub struct Bar; diff --git a/tests/rustdoc/deref-methods-19190-foreign-type.rs b/tests/rustdoc/deref-methods-19190-foreign-type.rs new file mode 100644 index 000000000..c83269921 --- /dev/null +++ b/tests/rustdoc/deref-methods-19190-foreign-type.rs @@ -0,0 +1,16 @@ +// https://github.com/rust-lang/rust/issues/19190 + +#![crate_name="issue_19190_2"] + +use std::ops::Deref; + +pub struct Bar; + +impl Deref for Bar { + type Target = String; + fn deref(&self) -> &String { loop {} } +} + +// @has issue_19190_2/struct.Bar.html +// @!has - '//*[@id="method.new"]' 'fn new() -> String' +// @has - '//*[@id="method.as_str"]' 'fn as_str(&self) -> &str' diff --git a/tests/rustdoc/deref-methods-19190-inline.rs b/tests/rustdoc/deref-methods-19190-inline.rs new file mode 100644 index 000000000..619b268d6 --- /dev/null +++ b/tests/rustdoc/deref-methods-19190-inline.rs @@ -0,0 +1,30 @@ +// aux-build:issue-19190-3.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/19190 +#![crate_name="issue_19190_3"] + +extern crate issue_19190_3; + +use std::ops::Deref; +use issue_19190_3::Baz; + +// @has issue_19190_3/struct.Foo.html +// @has - '//*[@id="method.as_str"]' 'fn as_str(&self) -> &str' +// @!has - '//*[@id="method.new"]' 'fn new() -> String' +pub use issue_19190_3::Foo; + +// @has issue_19190_3/struct.Bar.html +// @has - '//*[@id="method.baz"]' 'fn baz(&self)' +// @!has - '//*[@id="method.static_baz"]' 'fn static_baz()' +pub use issue_19190_3::Bar; + +// @has issue_19190_3/struct.MyBar.html +// @has - '//*[@id="method.baz"]' 'fn baz(&self)' +// @!has - '//*[@id="method.static_baz"]' 'fn static_baz()' +pub struct MyBar; + +impl Deref for MyBar { + type Target = Baz; + fn deref(&self) -> &Baz { loop {} } +} diff --git a/tests/rustdoc/deref-methods-19190.rs b/tests/rustdoc/deref-methods-19190.rs new file mode 100644 index 000000000..4c274d82f --- /dev/null +++ b/tests/rustdoc/deref-methods-19190.rs @@ -0,0 +1,23 @@ +// https://github.com/rust-lang/rust/issues/19190 +#![crate_name="issue_19190"] + +use std::ops::Deref; + +pub struct Foo; +pub struct Bar; + +impl Foo { + pub fn foo(&self) {} + pub fn static_foo() {} +} + +impl Deref for Bar { + type Target = Foo; + fn deref(&self) -> &Foo { loop {} } +} + +// @has issue_19190/struct.Bar.html +// @has - '//*[@id="method.foo"]//h4[@class="code-header"]' 'fn foo(&self)' +// @has - '//*[@id="method.foo"]' 'fn foo(&self)' +// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/tests/rustdoc/doc-hidden-method-13698.rs b/tests/rustdoc/doc-hidden-method-13698.rs new file mode 100644 index 000000000..f1bd6e73b --- /dev/null +++ b/tests/rustdoc/doc-hidden-method-13698.rs @@ -0,0 +1,19 @@ +// aux-build:issue-13698.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/13698 +#![crate_name="issue_13698"] + +extern crate issue_13698; + +pub struct Foo; +// @!has issue_13698/struct.Foo.html '//*[@id="method.foo"]' 'fn foo' +impl issue_13698::Foo for Foo {} + +pub trait Bar { + #[doc(hidden)] + fn bar(&self) {} +} + +// @!has issue_13698/struct.Foo.html '//*[@id="method.bar"]' 'fn bar' +impl Bar for Foo {} diff --git a/tests/rustdoc/doc-test-attr-18199.rs b/tests/rustdoc/doc-test-attr-18199.rs new file mode 100644 index 000000000..c9d223532 --- /dev/null +++ b/tests/rustdoc/doc-test-attr-18199.rs @@ -0,0 +1,11 @@ +// compile-flags:--test +// https://github.com/rust-lang/rust/issues/18199 + +#![doc(test(attr(feature(staged_api))))] + +/// ``` +/// #![allow(internal_features)] +/// #![unstable(feature="test", issue="18199")] +/// fn main() {} +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc/document-hidden-items-15347.rs b/tests/rustdoc/document-hidden-items-15347.rs new file mode 100644 index 000000000..d8a760e56 --- /dev/null +++ b/tests/rustdoc/document-hidden-items-15347.rs @@ -0,0 +1,8 @@ +// compile-flags: -Z unstable-options --document-hidden-items +// https://github.com/rust-lang/rust/issues/15347 + +#![crate_name="issue_15347"] + +// @has issue_15347/fn.foo.html +#[doc(hidden)] +pub fn foo() {} diff --git a/tests/rustdoc/highlight-invalid-rust-12834.rs b/tests/rustdoc/highlight-invalid-rust-12834.rs new file mode 100644 index 000000000..f8acc5002 --- /dev/null +++ b/tests/rustdoc/highlight-invalid-rust-12834.rs @@ -0,0 +1,14 @@ +// Tests that failing to syntax highlight a rust code-block doesn't cause +// rustdoc to fail, while still rendering the code-block (without highlighting). +// https://github.com/rust-lang/rust/issues/12834 + +#![crate_name="issue_12834"] +#![allow(rustdoc::invalid_rust_codeblocks)] + +// @has issue_12834/fn.foo.html +// @has - //pre 'a + b ' + +/// ``` +/// a + b ∈ Self ∀ a, b ∈ Self +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc/html-no-source.rs b/tests/rustdoc/html-no-source.rs new file mode 100644 index 000000000..25615a73c --- /dev/null +++ b/tests/rustdoc/html-no-source.rs @@ -0,0 +1,30 @@ +// compile-flags: -Zunstable-options --html-no-source + +// This test ensures that the `--html-no-source` flag disables +// the creation of the `src` folder. + +#![feature(staged_api)] +#![stable(feature = "bar", since = "1.0")] +#![crate_name = "foo"] + +// Ensures that there is no items in the corresponding "src" folder. +// @files 'src/foo' '[]' + +// @has foo/fn.foo.html +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +#[stable(feature = "bar", since = "1.0")] +pub fn foo() {} + +// @has foo/struct.Bar.html +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +#[stable(feature = "bar", since = "1.0")] +pub struct Bar; + +impl Bar { + // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0' + // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·' + #[stable(feature = "foobar", since = "2.0")] + pub fn bar() {} +} diff --git a/tests/rustdoc/ice-type-error-19181.rs b/tests/rustdoc/ice-type-error-19181.rs new file mode 100644 index 000000000..3ced61366 --- /dev/null +++ b/tests/rustdoc/ice-type-error-19181.rs @@ -0,0 +1,6 @@ +// compile-flags:--test +// https://github.com/rust-lang/rust/issues/19181 + +// rustdoc should not panic when target crate has compilation errors + +fn main() { 0 } diff --git a/tests/rustdoc/impl-ref-20175.rs b/tests/rustdoc/impl-ref-20175.rs new file mode 100644 index 000000000..a92db2d0a --- /dev/null +++ b/tests/rustdoc/impl-ref-20175.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/20175 + +#![crate_name="issue_20175"] + +pub trait Foo { + fn foo(&self) {} +} + +pub struct Bar; + +// @has issue_20175/struct.Bar.html \ +// '//*[@id="method.foo"]' \ +// 'fn foo' +impl<'a> Foo for &'a Bar {} diff --git a/tests/rustdoc/infinite-redirection-16265-1.rs b/tests/rustdoc/infinite-redirection-16265-1.rs new file mode 100644 index 000000000..7d72469bd --- /dev/null +++ b/tests/rustdoc/infinite-redirection-16265-1.rs @@ -0,0 +1,13 @@ +// https://github.com/rust-lang/rust/issues/16265 +#![crate_name="issue_16265_1"] + +pub struct Foo; + +// @hasraw issue_16265_1/traits/index.html 'source' +pub mod traits { + impl PartialEq for super::Foo { + fn eq(&self, _: &super::Foo) -> bool { + true + } + } +} diff --git a/tests/rustdoc/infinite-redirection-16265-2.rs b/tests/rustdoc/infinite-redirection-16265-2.rs new file mode 100644 index 000000000..7a4791c5f --- /dev/null +++ b/tests/rustdoc/infinite-redirection-16265-2.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/16265 +#![crate_name="issue_16265_2"] + +// @hasraw issue_16265_2/index.html 'source' + +trait Y {} +impl Y for Option {} diff --git a/tests/rustdoc/inline-assoc-type-20727-bindings.rs b/tests/rustdoc/inline-assoc-type-20727-bindings.rs new file mode 100644 index 000000000..e59dec29d --- /dev/null +++ b/tests/rustdoc/inline-assoc-type-20727-bindings.rs @@ -0,0 +1,25 @@ +// aux-build:issue-20727.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/20727 +#![crate_name="issue_20727_2"] + +extern crate issue_20727; + +// @has issue_20727_2/trait.Add.html +pub trait Add { + // @has - '//pre[@class="rust item-decl"]' 'trait Add {' + // @has - '//pre[@class="rust item-decl"]' 'type Output;' + type Output; + + // @has - '//pre[@class="rust item-decl"]' 'fn add(self, rhs: RHS) -> Self::Output;' + fn add(self, rhs: RHS) -> Self::Output; +} + +// @has issue_20727_2/reexport/trait.Add.html +pub mod reexport { + // @has - '//pre[@class="rust item-decl"]' 'trait Add {' + // @has - '//pre[@class="rust item-decl"]' 'type Output;' + // @has - '//pre[@class="rust item-decl"]' 'fn add(self, rhs: RHS) -> Self::Output;' + pub use issue_20727::Add; +} diff --git a/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs b/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs new file mode 100644 index 000000000..005ee3e32 --- /dev/null +++ b/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs @@ -0,0 +1,27 @@ +// aux-build:issue-20727.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/20727 +#![crate_name="issue_20727_3"] + +extern crate issue_20727; + +pub trait Bar {} + +// @has issue_20727_3/trait.Deref2.html +pub trait Deref2 { + // @has - '//pre[@class="rust item-decl"]' 'trait Deref2 {' + // @has - '//pre[@class="rust item-decl"]' 'type Target: Bar;' + type Target: Bar; + + // @has - '//pre[@class="rust item-decl"]' 'fn deref(&self) -> Self::Target;' + fn deref(&self) -> Self::Target; +} + +// @has issue_20727_3/reexport/trait.Deref2.html +pub mod reexport { + // @has - '//pre[@class="rust item-decl"]' 'trait Deref2 {' + // @has - '//pre[@class="rust item-decl"]' 'type Target: Bar;' + // @has - '//pre[@class="rust item-decl"]' 'fn deref(&self) -> Self::Target;' + pub use issue_20727::Deref2; +} diff --git a/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs b/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs new file mode 100644 index 000000000..1a3f4cd20 --- /dev/null +++ b/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs @@ -0,0 +1,43 @@ +// aux-build:issue-20727.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/20727 +#![crate_name="issue_20727_4"] + +extern crate issue_20727; + +// @has issue_20727_4/trait.Index.html +pub trait Index { + // @has - '//pre[@class="rust item-decl"]' 'trait Index {' + // @has - '//pre[@class="rust item-decl"]' 'type Output: ?Sized' + type Output: ?Sized; + + // @has - '//pre[@class="rust item-decl"]' \ + // 'fn index(&self, index: Idx) -> &Self::Output' + fn index(&self, index: Idx) -> &Self::Output; +} + +// @has issue_20727_4/trait.IndexMut.html +pub trait IndexMut: Index { + // @has - '//pre[@class="rust item-decl"]' \ + // 'trait IndexMut: Index {' + // @has - '//pre[@class="rust item-decl"]' \ + // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' + fn index_mut(&mut self, index: Idx) -> &mut Self::Output; +} + +pub mod reexport { + // @has issue_20727_4/reexport/trait.Index.html + // @has - '//pre[@class="rust item-decl"]' 'trait Indexwhere Idx: ?Sized,{' + // @has - '//pre[@class="rust item-decl"]' 'type Output: ?Sized' + // @has - '//pre[@class="rust item-decl"]' \ + // 'fn index(&self, index: Idx) -> &Self::Output' + pub use issue_20727::Index; + + // @has issue_20727_4/reexport/trait.IndexMut.html + // @has - '//pre[@class="rust item-decl"]' \ + // 'trait IndexMut: Indexwhere Idx: ?Sized,{' + // @has - '//pre[@class="rust item-decl"]' \ + // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' + pub use issue_20727::IndexMut; +} diff --git a/tests/rustdoc/inline-assoc-type-20727-bounds.rs b/tests/rustdoc/inline-assoc-type-20727-bounds.rs new file mode 100644 index 000000000..7cbc8d381 --- /dev/null +++ b/tests/rustdoc/inline-assoc-type-20727-bounds.rs @@ -0,0 +1,27 @@ +// aux-build:issue-20727.rs +// ignore-cross-compile + +// https://github.com/rust-lang/rust/issues/20727 +#![crate_name="issue_20727"] + +extern crate issue_20727; + +// @has issue_20727/trait.Deref.html +pub trait Deref { + // @has - '//pre[@class="rust item-decl"]' 'trait Deref {' + // @has - '//pre[@class="rust item-decl"]' 'type Target: ?Sized;' + type Target: ?Sized; + + // @has - '//pre[@class="rust item-decl"]' \ + // "fn deref<'a>(&'a self) -> &'a Self::Target;" + fn deref<'a>(&'a self) -> &'a Self::Target; +} + +// @has issue_20727/reexport/trait.Deref.html +pub mod reexport { + // @has - '//pre[@class="rust item-decl"]' 'trait Deref {' + // @has - '//pre[@class="rust item-decl"]' 'type Target: ?Sized;' + // @has - '//pre[@class="rust item-decl"]' \ + // "fn deref<'a>(&'a self) -> &'a Self::Target;" + pub use issue_20727::Deref; +} diff --git a/tests/rustdoc/inline_cross/async-fn.rs b/tests/rustdoc/inline_cross/async-fn.rs new file mode 100644 index 000000000..95e175aab --- /dev/null +++ b/tests/rustdoc/inline_cross/async-fn.rs @@ -0,0 +1,19 @@ +// Regression test for issue #115760. +// Check that we render the correct return type of free and +// associated async functions reexported from external crates. + +// aux-crate:async_fn=async-fn.rs +// edition: 2021 +#![crate_name = "user"] + +// @has user/fn.load.html +// @has - '//pre[@class="rust item-decl"]' "pub async fn load() -> i32" +pub use async_fn::load; + +// @has user/trait.Load.html +// @has - '//*[@id="tymethod.run"]' 'async fn run(&self) -> i32' +pub use async_fn::Load; + +// @has user/struct.Loader.html +// @has - '//*[@id="method.run"]' 'async fn run(&self) -> i32' +pub use async_fn::Loader; diff --git a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs new file mode 100644 index 000000000..767564ed1 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs @@ -0,0 +1,18 @@ +#![feature(async_fn_in_trait)] +// edition: 2021 + +pub async fn load() -> i32 { + 0 +} + +pub trait Load { + async fn run(&self) -> i32; +} + +pub struct Loader; + +impl Load for Loader { + async fn run(&self) -> i32 { + 1 + } +} diff --git a/tests/rustdoc/inline_cross/auxiliary/const-fn.rs b/tests/rustdoc/inline_cross/auxiliary/const-fn.rs new file mode 100644 index 000000000..26332b419 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/const-fn.rs @@ -0,0 +1,5 @@ +#![feature(effects)] + +pub const fn load() -> i32 { + 0 +} diff --git a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs index 19433c968..42cfc3dc3 100644 --- a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs +++ b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs @@ -33,9 +33,3 @@ pub struct Foo; impl Foo { pub fn method<'a>(_x: impl Clone + Into> + 'a) {} } - -pub struct Bar; - -impl Bar { - pub async fn async_foo(&self) {} -} diff --git a/tests/rustdoc/inline_cross/const-fn.rs b/tests/rustdoc/inline_cross/const-fn.rs new file mode 100644 index 000000000..24934b873 --- /dev/null +++ b/tests/rustdoc/inline_cross/const-fn.rs @@ -0,0 +1,10 @@ +// Regression test for issue #116629. +// Check that we render the correct generic params of const fn + +// aux-crate:const_fn=const-fn.rs +// edition: 2021 +#![crate_name = "user"] + +// @has user/fn.load.html +// @has - '//pre[@class="rust item-decl"]' "pub const fn load() -> i32" +pub use const_fn::load; diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs index b6a1552bc..5c802c514 100644 --- a/tests/rustdoc/inline_cross/impl_trait.rs +++ b/tests/rustdoc/inline_cross/impl_trait.rs @@ -33,15 +33,7 @@ pub use impl_trait_aux::func4; // @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func5; -// @has impl_trait/fn.async_fn.html -// @has - '//pre[@class="rust item-decl"]' "pub async fn async_fn()" -pub use impl_trait_aux::async_fn; - // @has impl_trait/struct.Foo.html // @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into> + 'a)" // @!has - '//*[@id="method.method"]//h4[@class="code-header"]' 'where' pub use impl_trait_aux::Foo; - -// @has impl_trait/struct.Bar.html -// @has - '//*[@id="method.async_foo"]' "pub async fn async_foo(" -pub use impl_trait_aux::Bar; diff --git a/tests/rustdoc/issue-105735-overlapping-reexport-2.rs b/tests/rustdoc/issue-105735-overlapping-reexport-2.rs index 910824839..5d2c553d8 100644 --- a/tests/rustdoc/issue-105735-overlapping-reexport-2.rs +++ b/tests/rustdoc/issue-105735-overlapping-reexport-2.rs @@ -8,7 +8,7 @@ // @has - '//*[@class="item-name"]/a[@class="constant"]' 'AtomicU8' // We also ensure we don't have another item displayed. // @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 2 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Definitions' +// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Aliases' // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Constants' mod other { diff --git a/tests/rustdoc/issue-109449-doc-hidden-reexports.rs b/tests/rustdoc/issue-109449-doc-hidden-reexports.rs index b0c225401..3b836a219 100644 --- a/tests/rustdoc/issue-109449-doc-hidden-reexports.rs +++ b/tests/rustdoc/issue-109449-doc-hidden-reexports.rs @@ -104,7 +104,7 @@ pub mod glob_reexport { // @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 3 // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Re-exports' // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs' - // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Definitions' + // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Aliases' // Now we check we have 1 re-export and 2 inlined items. // If not item from a glob re-export is visible, we don't show the re-export. @@ -135,9 +135,9 @@ pub mod doc_hidden_reexport { // @has - '//a[@class="struct"]' 'Reexport' // Check that the `#[doc(hidden)]` re-export's attributes are not taken into account. // @has - '//*[@class="desc docblock-short"]' 'Visible. Original.' + /// Visible. + pub use self::Bar3 as Reexport; /// Hidden. #[doc(hidden)] pub use crate::private::Bar3; - /// Visible. - pub use self::Bar3 as Reexport; } diff --git a/tests/rustdoc/issue-12834.rs b/tests/rustdoc/issue-12834.rs deleted file mode 100644 index 9605a1e78..000000000 --- a/tests/rustdoc/issue-12834.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Tests that failing to syntax highlight a rust code-block doesn't cause -// rustdoc to fail, while still rendering the code-block (without highlighting). - -#![allow(rustdoc::invalid_rust_codeblocks)] - -// @has issue_12834/fn.foo.html -// @has - //pre 'a + b ' - -/// ``` -/// a + b ∈ Self ∀ a, b ∈ Self -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc/issue-13698.rs b/tests/rustdoc/issue-13698.rs deleted file mode 100644 index 3046a8a28..000000000 --- a/tests/rustdoc/issue-13698.rs +++ /dev/null @@ -1,16 +0,0 @@ -// aux-build:issue-13698.rs -// ignore-cross-compile - -extern crate issue_13698; - -pub struct Foo; -// @!has issue_13698/struct.Foo.html '//*[@id="method.foo"]' 'fn foo' -impl issue_13698::Foo for Foo {} - -pub trait Bar { - #[doc(hidden)] - fn bar(&self) {} -} - -// @!has issue_13698/struct.Foo.html '//*[@id="method.bar"]' 'fn bar' -impl Bar for Foo {} diff --git a/tests/rustdoc/issue-15169.rs b/tests/rustdoc/issue-15169.rs deleted file mode 100644 index e525d85e2..000000000 --- a/tests/rustdoc/issue-15169.rs +++ /dev/null @@ -1,3 +0,0 @@ -// @has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq' -#[derive(PartialEq)] -pub struct Foo; diff --git a/tests/rustdoc/issue-15318-2.rs b/tests/rustdoc/issue-15318-2.rs deleted file mode 100644 index 614f2c1c0..000000000 --- a/tests/rustdoc/issue-15318-2.rs +++ /dev/null @@ -1,12 +0,0 @@ -// aux-build:issue-15318.rs -// ignore-cross-compile -#![no_std] - -extern crate issue_15318; - -pub use issue_15318::ptr; - -// @!has issue_15318_2/fn.bar.html \ -// '//*[@href="primitive.pointer.html"]' \ -// '*mut T' -pub fn bar(ptr: *mut T) {} diff --git a/tests/rustdoc/issue-15318-3.rs b/tests/rustdoc/issue-15318-3.rs deleted file mode 100644 index 2dab8f948..000000000 --- a/tests/rustdoc/issue-15318-3.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(rustc_attrs)] - -// @has issue_15318_3/primitive.pointer.html - -/// dox -#[rustc_doc_primitive = "pointer"] -pub mod ptr {} diff --git a/tests/rustdoc/issue-15318.rs b/tests/rustdoc/issue-15318.rs deleted file mode 100644 index 0349fe285..000000000 --- a/tests/rustdoc/issue-15318.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:issue-15318.rs -// ignore-cross-compile - -#![no_std] - -extern crate issue_15318; - -// @has issue_15318/fn.bar.html \ -// '//*[@href="http://example.com/issue_15318/primitive.pointer.html"]' \ -// '*mut T' -pub fn bar(ptr: *mut T) {} diff --git a/tests/rustdoc/issue-15347.rs b/tests/rustdoc/issue-15347.rs deleted file mode 100644 index e93d74011..000000000 --- a/tests/rustdoc/issue-15347.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags: -Z unstable-options --document-hidden-items - -// @has issue_15347/fn.foo.html -#[doc(hidden)] -pub fn foo() {} diff --git a/tests/rustdoc/issue-16019.rs b/tests/rustdoc/issue-16019.rs deleted file mode 100644 index 239d92378..000000000 --- a/tests/rustdoc/issue-16019.rs +++ /dev/null @@ -1,9 +0,0 @@ -macro_rules! define_struct { - ($rounds:expr) => ( - struct Struct { - sk: [u32; $rounds + 1] - } - ) -} - -define_struct!(2); diff --git a/tests/rustdoc/issue-16265-1.rs b/tests/rustdoc/issue-16265-1.rs deleted file mode 100644 index 2fda637a6..000000000 --- a/tests/rustdoc/issue-16265-1.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub struct Foo; - -// @hasraw issue_16265_1/traits/index.html 'source' -pub mod traits { - impl PartialEq for super::Foo { - fn eq(&self, _: &super::Foo) -> bool { - true - } - } -} diff --git a/tests/rustdoc/issue-16265-2.rs b/tests/rustdoc/issue-16265-2.rs deleted file mode 100644 index c3eb35617..000000000 --- a/tests/rustdoc/issue-16265-2.rs +++ /dev/null @@ -1,4 +0,0 @@ -// @hasraw issue_16265_2/index.html 'source' - -trait Y {} -impl Y for Option {} diff --git a/tests/rustdoc/issue-17476.rs b/tests/rustdoc/issue-17476.rs deleted file mode 100644 index a5b484c98..000000000 --- a/tests/rustdoc/issue-17476.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:issue-17476.rs -// ignore-cross-compile - -extern crate issue_17476; - -pub struct Foo; - -// @has issue_17476/struct.Foo.html \ -// '//*[@href="http://example.com/issue_17476/trait.Foo.html#method.foo"]' \ -// 'foo' -impl issue_17476::Foo for Foo {} diff --git a/tests/rustdoc/issue-18199.rs b/tests/rustdoc/issue-18199.rs deleted file mode 100644 index 9cc58b162..000000000 --- a/tests/rustdoc/issue-18199.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags:--test - -#![doc(test(attr(feature(staged_api))))] - -/// ``` -/// #![allow(internal_features)] -/// #![unstable(feature="test", issue="18199")] -/// fn main() {} -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc/issue-19181.rs b/tests/rustdoc/issue-19181.rs deleted file mode 100644 index 3dea152fc..000000000 --- a/tests/rustdoc/issue-19181.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags:--test - -// rustdoc should not panic when target crate has compilation errors - -fn main() { 0 } diff --git a/tests/rustdoc/issue-19190-2.rs b/tests/rustdoc/issue-19190-2.rs deleted file mode 100644 index b6416e2e5..000000000 --- a/tests/rustdoc/issue-19190-2.rs +++ /dev/null @@ -1,12 +0,0 @@ -use std::ops::Deref; - -pub struct Bar; - -impl Deref for Bar { - type Target = String; - fn deref(&self) -> &String { loop {} } -} - -// @has issue_19190_2/struct.Bar.html -// @!has - '//*[@id="method.new"]' 'fn new() -> String' -// @has - '//*[@id="method.as_str"]' 'fn as_str(&self) -> &str' diff --git a/tests/rustdoc/issue-19190-3.rs b/tests/rustdoc/issue-19190-3.rs deleted file mode 100644 index 4d34ce650..000000000 --- a/tests/rustdoc/issue-19190-3.rs +++ /dev/null @@ -1,27 +0,0 @@ -// aux-build:issue-19190-3.rs -// ignore-cross-compile - -extern crate issue_19190_3; - -use std::ops::Deref; -use issue_19190_3::Baz; - -// @has issue_19190_3/struct.Foo.html -// @has - '//*[@id="method.as_str"]' 'fn as_str(&self) -> &str' -// @!has - '//*[@id="method.new"]' 'fn new() -> String' -pub use issue_19190_3::Foo; - -// @has issue_19190_3/struct.Bar.html -// @has - '//*[@id="method.baz"]' 'fn baz(&self)' -// @!has - '//*[@id="method.static_baz"]' 'fn static_baz()' -pub use issue_19190_3::Bar; - -// @has issue_19190_3/struct.MyBar.html -// @has - '//*[@id="method.baz"]' 'fn baz(&self)' -// @!has - '//*[@id="method.static_baz"]' 'fn static_baz()' -pub struct MyBar; - -impl Deref for MyBar { - type Target = Baz; - fn deref(&self) -> &Baz { loop {} } -} diff --git a/tests/rustdoc/issue-19190.rs b/tests/rustdoc/issue-19190.rs deleted file mode 100644 index 2046273e2..000000000 --- a/tests/rustdoc/issue-19190.rs +++ /dev/null @@ -1,20 +0,0 @@ -use std::ops::Deref; - -pub struct Foo; -pub struct Bar; - -impl Foo { - pub fn foo(&self) {} - pub fn static_foo() {} -} - -impl Deref for Bar { - type Target = Foo; - fn deref(&self) -> &Foo { loop {} } -} - -// @has issue_19190/struct.Bar.html -// @has - '//*[@id="method.foo"]//h4[@class="code-header"]' 'fn foo(&self)' -// @has - '//*[@id="method.foo"]' 'fn foo(&self)' -// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' -// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/tests/rustdoc/issue-20175.rs b/tests/rustdoc/issue-20175.rs deleted file mode 100644 index 6a42e2afb..000000000 --- a/tests/rustdoc/issue-20175.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub trait Foo { - fn foo(&self) {} -} - -pub struct Bar; - -// @has issue_20175/struct.Bar.html \ -// '//*[@id="method.foo"]' \ -// 'fn foo' -impl<'a> Foo for &'a Bar {} diff --git a/tests/rustdoc/issue-20646.rs b/tests/rustdoc/issue-20646.rs deleted file mode 100644 index b2ee9c260..000000000 --- a/tests/rustdoc/issue-20646.rs +++ /dev/null @@ -1,26 +0,0 @@ -// aux-build:issue-20646.rs -// ignore-cross-compile - -#![feature(associated_types)] - -extern crate issue_20646; - -// @has issue_20646/trait.Trait.html \ -// '//*[@id="associatedtype.Output"]' \ -// 'type Output' -pub trait Trait { - type Output; -} - -// @has issue_20646/fn.fun.html \ -// '//pre[@class="rust item-decl"]' 'where T: Trait' -pub fn fun(_: T) where T: Trait {} - -pub mod reexport { - // @has issue_20646/reexport/trait.Trait.html \ - // '//*[@id="associatedtype.Output"]' \ - // 'type Output' - // @has issue_20646/reexport/fn.fun.html \ - // '//pre[@class="rust item-decl"]' 'where T: Trait' - pub use issue_20646::{Trait, fun}; -} diff --git a/tests/rustdoc/issue-20727-2.rs b/tests/rustdoc/issue-20727-2.rs deleted file mode 100644 index c1aa9617b..000000000 --- a/tests/rustdoc/issue-20727-2.rs +++ /dev/null @@ -1,22 +0,0 @@ -// aux-build:issue-20727.rs -// ignore-cross-compile - -extern crate issue_20727; - -// @has issue_20727_2/trait.Add.html -pub trait Add { - // @has - '//pre[@class="rust item-decl"]' 'trait Add {' - // @has - '//pre[@class="rust item-decl"]' 'type Output;' - type Output; - - // @has - '//pre[@class="rust item-decl"]' 'fn add(self, rhs: RHS) -> Self::Output;' - fn add(self, rhs: RHS) -> Self::Output; -} - -// @has issue_20727_2/reexport/trait.Add.html -pub mod reexport { - // @has - '//pre[@class="rust item-decl"]' 'trait Add {' - // @has - '//pre[@class="rust item-decl"]' 'type Output;' - // @has - '//pre[@class="rust item-decl"]' 'fn add(self, rhs: RHS) -> Self::Output;' - pub use issue_20727::Add; -} diff --git a/tests/rustdoc/issue-20727-3.rs b/tests/rustdoc/issue-20727-3.rs deleted file mode 100644 index 2f9d91fc5..000000000 --- a/tests/rustdoc/issue-20727-3.rs +++ /dev/null @@ -1,24 +0,0 @@ -// aux-build:issue-20727.rs -// ignore-cross-compile - -extern crate issue_20727; - -pub trait Bar {} - -// @has issue_20727_3/trait.Deref2.html -pub trait Deref2 { - // @has - '//pre[@class="rust item-decl"]' 'trait Deref2 {' - // @has - '//pre[@class="rust item-decl"]' 'type Target: Bar;' - type Target: Bar; - - // @has - '//pre[@class="rust item-decl"]' 'fn deref(&self) -> Self::Target;' - fn deref(&self) -> Self::Target; -} - -// @has issue_20727_3/reexport/trait.Deref2.html -pub mod reexport { - // @has - '//pre[@class="rust item-decl"]' 'trait Deref2 {' - // @has - '//pre[@class="rust item-decl"]' 'type Target: Bar;' - // @has - '//pre[@class="rust item-decl"]' 'fn deref(&self) -> Self::Target;' - pub use issue_20727::Deref2; -} diff --git a/tests/rustdoc/issue-20727-4.rs b/tests/rustdoc/issue-20727-4.rs deleted file mode 100644 index ec9f18fc3..000000000 --- a/tests/rustdoc/issue-20727-4.rs +++ /dev/null @@ -1,40 +0,0 @@ -// aux-build:issue-20727.rs -// ignore-cross-compile - -extern crate issue_20727; - -// @has issue_20727_4/trait.Index.html -pub trait Index { - // @has - '//pre[@class="rust item-decl"]' 'trait Index {' - // @has - '//pre[@class="rust item-decl"]' 'type Output: ?Sized' - type Output: ?Sized; - - // @has - '//pre[@class="rust item-decl"]' \ - // 'fn index(&self, index: Idx) -> &Self::Output' - fn index(&self, index: Idx) -> &Self::Output; -} - -// @has issue_20727_4/trait.IndexMut.html -pub trait IndexMut: Index { - // @has - '//pre[@class="rust item-decl"]' \ - // 'trait IndexMut: Index {' - // @has - '//pre[@class="rust item-decl"]' \ - // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' - fn index_mut(&mut self, index: Idx) -> &mut Self::Output; -} - -pub mod reexport { - // @has issue_20727_4/reexport/trait.Index.html - // @has - '//pre[@class="rust item-decl"]' 'trait Indexwhere Idx: ?Sized,{' - // @has - '//pre[@class="rust item-decl"]' 'type Output: ?Sized' - // @has - '//pre[@class="rust item-decl"]' \ - // 'fn index(&self, index: Idx) -> &Self::Output' - pub use issue_20727::Index; - - // @has issue_20727_4/reexport/trait.IndexMut.html - // @has - '//pre[@class="rust item-decl"]' \ - // 'trait IndexMut: Indexwhere Idx: ?Sized,{' - // @has - '//pre[@class="rust item-decl"]' \ - // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' - pub use issue_20727::IndexMut; -} diff --git a/tests/rustdoc/issue-20727.rs b/tests/rustdoc/issue-20727.rs deleted file mode 100644 index 266848bee..000000000 --- a/tests/rustdoc/issue-20727.rs +++ /dev/null @@ -1,24 +0,0 @@ -// aux-build:issue-20727.rs -// ignore-cross-compile - -extern crate issue_20727; - -// @has issue_20727/trait.Deref.html -pub trait Deref { - // @has - '//pre[@class="rust item-decl"]' 'trait Deref {' - // @has - '//pre[@class="rust item-decl"]' 'type Target: ?Sized;' - type Target: ?Sized; - - // @has - '//pre[@class="rust item-decl"]' \ - // "fn deref<'a>(&'a self) -> &'a Self::Target;" - fn deref<'a>(&'a self) -> &'a Self::Target; -} - -// @has issue_20727/reexport/trait.Deref.html -pub mod reexport { - // @has - '//pre[@class="rust item-decl"]' 'trait Deref {' - // @has - '//pre[@class="rust item-decl"]' 'type Target: ?Sized;' - // @has - '//pre[@class="rust item-decl"]' \ - // "fn deref<'a>(&'a self) -> &'a Self::Target;" - pub use issue_20727::Deref; -} diff --git a/tests/rustdoc/issue-32077-type-alias-impls.rs b/tests/rustdoc/issue-32077-type-alias-impls.rs new file mode 100644 index 000000000..ac486c36a --- /dev/null +++ b/tests/rustdoc/issue-32077-type-alias-impls.rs @@ -0,0 +1,66 @@ +// Regression test for . + +#![crate_name = "foo"] + +pub struct GenericStruct(T); + +impl GenericStruct { + pub fn on_gen(arg: T) {} +} + +impl GenericStruct { + pub fn on_u32(arg: u32) {} +} + +pub trait Foo {} +pub trait Bar {} + +impl Foo for GenericStruct {} +impl Bar for GenericStruct {} + +// @has 'foo/type.TypedefStruct.html' +// We check that "Aliased type" is also present as a title in the sidebar. +// @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type' +// We check that we have the implementation of the type alias itself. +// @has - '//*[@id="impl-TypedefStruct"]/h3' 'impl TypedefStruct' +// @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()' +// @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl GenericStruct' +// @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)' +// @has - '//*[@id="impl-Foo-for-GenericStruct%3CT%3E"]/h3' 'impl Foo for GenericStruct' +// This trait implementation doesn't match the type alias parameters so shouldn't appear in docs. +// @!has - '//h3' 'impl Bar for GenericStruct {}' +// Same goes for the `Deref` impl. +// @!has - '//h2' 'Methods from Deref' +// @count - '//nav[@class="sidebar"]//a' 'on_alias' 1 +// @count - '//nav[@class="sidebar"]//a' 'on_gen' 1 +// @count - '//nav[@class="sidebar"]//a' 'Foo' 1 +// @!has - '//nav[@class="sidebar"]//a' 'Bar' +// @!has - '//nav[@class="sidebar"]//a' 'on_u32' +pub type TypedefStruct = GenericStruct; + +impl TypedefStruct { + pub fn on_alias() {} +} + +impl std::ops::Deref for GenericStruct { + type Target = u32; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +pub struct Wrap(GenericStruct); + +// @has 'foo/type.Alias.html' +// @has - '//h2' 'Methods from Deref' +// @has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl Deref for Wrap' +pub type Alias = Wrap; + +impl std::ops::Deref for Wrap { + type Target = GenericStruct; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/tests/rustdoc/issue-88600.rs b/tests/rustdoc/issue-88600.rs index db0d102b7..f89af472f 100644 --- a/tests/rustdoc/issue-88600.rs +++ b/tests/rustdoc/issue-88600.rs @@ -8,10 +8,10 @@ pub struct S; // @has issue_88600/enum.FooEnum.html pub enum FooEnum { - // @has - '//*[@id="variant.HiddenTupleItem"]//h3' 'HiddenTupleItem(_)' + // @has - '//*[@id="variant.HiddenTupleItem"]//h3' 'HiddenTupleItem(/* private fields */)' // @count - '//*[@id="variant.HiddenTupleItem.field.0"]' 0 HiddenTupleItem(#[doc(hidden)] H), - // @has - '//*[@id="variant.MultipleHidden"]//h3' 'MultipleHidden(_, _)' + // @has - '//*[@id="variant.MultipleHidden"]//h3' 'MultipleHidden(/* private fields */)' // @count - '//*[@id="variant.MultipleHidden.field.0"]' 0 // @count - '//*[@id="variant.MultipleHidden.field.1"]' 0 MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H), diff --git a/tests/rustdoc/macro-ice-16019.rs b/tests/rustdoc/macro-ice-16019.rs new file mode 100644 index 000000000..d0f82e0a3 --- /dev/null +++ b/tests/rustdoc/macro-ice-16019.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/16019 + +macro_rules! define_struct { + ($rounds:expr) => ( + struct Struct { + sk: [u32; $rounds + 1] + } + ) +} + +define_struct!(2); diff --git a/tests/rustdoc/method-link-foreign-trait-impl-17476.rs b/tests/rustdoc/method-link-foreign-trait-impl-17476.rs new file mode 100644 index 000000000..e52ab6f38 --- /dev/null +++ b/tests/rustdoc/method-link-foreign-trait-impl-17476.rs @@ -0,0 +1,14 @@ +// aux-build:issue-17476.rs +// ignore-cross-compile +// https://github.com/rust-lang/rust/issues/17476 + +#![crate_name="issue_17476"] + +extern crate issue_17476; + +pub struct Foo; + +// @has issue_17476/struct.Foo.html \ +// '//*[@href="http://example.com/issue_17476/trait.Foo.html#method.foo"]' \ +// 'foo' +impl issue_17476::Foo for Foo {} diff --git a/tests/rustdoc/no-crate-filter.rs b/tests/rustdoc/no-crate-filter.rs deleted file mode 100644 index b2f899064..000000000 --- a/tests/rustdoc/no-crate-filter.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name = "foo"] - -// compile-flags: -Z unstable-options --disable-per-crate-search - -// @!has 'foo/struct.Foo.html' '//*[id="crate-search"]' '' -pub struct Foo; diff --git a/tests/rustdoc/primitive-raw-pointer-dox-15318-3.rs b/tests/rustdoc/primitive-raw-pointer-dox-15318-3.rs new file mode 100644 index 000000000..80c559756 --- /dev/null +++ b/tests/rustdoc/primitive-raw-pointer-dox-15318-3.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/15318 +#![crate_name="issue_15318_3"] +#![feature(rustc_attrs)] + +// @has issue_15318_3/primitive.pointer.html + +/// dox +#[rustc_doc_primitive = "pointer"] +pub mod ptr {} diff --git a/tests/rustdoc/primitive-raw-pointer-link-15318.rs b/tests/rustdoc/primitive-raw-pointer-link-15318.rs new file mode 100644 index 000000000..77f25ff4c --- /dev/null +++ b/tests/rustdoc/primitive-raw-pointer-link-15318.rs @@ -0,0 +1,13 @@ +// aux-build:issue-15318.rs +// ignore-cross-compile +// https://github.com/rust-lang/rust/issues/15318 + +#![crate_name="issue_15318"] +#![no_std] + +extern crate issue_15318; + +// @has issue_15318/fn.bar.html \ +// '//*[@href="http://example.com/issue_15318/primitive.pointer.html"]' \ +// '*mut T' +pub fn bar(ptr: *mut T) {} diff --git a/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs b/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs new file mode 100644 index 000000000..1b35bb185 --- /dev/null +++ b/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs @@ -0,0 +1,15 @@ +// aux-build:issue-15318.rs +// ignore-cross-compile +// https://github.com/rust-lang/rust/issues/15318 + +#![crate_name="issue_15318_2"] +#![no_std] + +extern crate issue_15318; + +pub use issue_15318::ptr; + +// @!has issue_15318_2/fn.bar.html \ +// '//*[@href="primitive.pointer.html"]' \ +// '*mut T' +pub fn bar(ptr: *mut T) {} diff --git a/tests/rustdoc/private-fields-tuple-struct.rs b/tests/rustdoc/private-fields-tuple-struct.rs new file mode 100644 index 000000000..c6989dd8c --- /dev/null +++ b/tests/rustdoc/private-fields-tuple-struct.rs @@ -0,0 +1,15 @@ +// This test checks the diplay of "/* private fields */" sentence in tuple structs. +#![crate_name = "foo"] + +// @has 'foo/struct.A.html' '//*[@class="rust item-decl"]/code' 'pub struct A(pub u8, _);' +pub struct A(pub u8, u8); +// @has 'foo/struct.B.html' '//*[@class="rust item-decl"]/code' 'pub struct B(_, pub u8);' +pub struct B(u8, pub u8); +// @has 'foo/struct.C.html' '//*[@class="rust item-decl"]/code' 'pub struct C(_, pub u8, _);' +pub struct C(u8, pub u8, u8); +// @has 'foo/struct.D.html' '//*[@class="rust item-decl"]/code' 'pub struct D(pub u8, _, pub u8);' +pub struct D(pub u8, u8, pub u8); +// @has 'foo/struct.E.html' '//*[@class="rust item-decl"]/code' 'pub struct E(/* private fields */);' +pub struct E(u8); +// @has 'foo/struct.F.html' '//*[@class="rust item-decl"]/code' 'pub struct F(/* private fields */);' +pub struct F(u8, u8); diff --git a/tests/rustdoc/rfc-2632-const-trait-impl.rs b/tests/rustdoc/rfc-2632-const-trait-impl.rs index 5d742dc39..7f56b2ffe 100644 --- a/tests/rustdoc/rfc-2632-const-trait-impl.rs +++ b/tests/rustdoc/rfc-2632-const-trait-impl.rs @@ -5,6 +5,8 @@ // To future blessers: make sure that `const_trait_impl` is // stabilized when changing `@!has` to `@has`, and please do // not remove this test. +// +// FIXME(effects) add `const_trait` to `Fn` so we use `~const` #![feature(const_trait_impl)] #![crate_name = "foo"] @@ -22,9 +24,9 @@ pub trait Tr { // @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn' // @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const' // @has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn' - fn a() + fn a() where - Option: ~const Fn() + ~const Destruct, + Option: /* ~const */ Fn() + ~const Destruct, { } } @@ -34,13 +36,13 @@ pub trait Tr { // @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Fn' // @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const' // @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn' -impl const Tr for T +impl const Tr for T where - Option: ~const Fn() + ~const Destruct, + Option: /* ~const */ Fn() + ~const Destruct, { - fn a() + fn a() where - Option: ~const Fn() + ~const Destruct, + Option: /* ~const */ Fn() + ~const Destruct, { } } @@ -49,9 +51,9 @@ where // @has - '//pre[@class="rust item-decl"]/code/a[@class="trait"]' 'Fn' // @!has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' '~const' // @has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' ': Fn' -pub const fn foo() +pub const fn foo() where - Option: ~const Fn() + ~const Destruct, + Option: /* ~const */ Fn() + ~const Destruct, { F::a() } @@ -61,9 +63,9 @@ impl S { // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn' // @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const' // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn' - pub const fn foo() + pub const fn foo() where - B: ~const Fn() + ~const Destruct, + B: /* ~const */ Fn() + ~const Destruct, { B::a() } diff --git a/tests/rustdoc/show-const-contents.rs b/tests/rustdoc/show-const-contents.rs index 69e742ee7..91df03adb 100644 --- a/tests/rustdoc/show-const-contents.rs +++ b/tests/rustdoc/show-const-contents.rs @@ -47,7 +47,7 @@ pub struct MyTypeWithStr(&'static str); // @!hasraw show_const_contents/constant.MY_TYPE_WITH_STR.html '; //' pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this"); -// @hasraw show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' +// @hasraw show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288_f32;' // @hasraw show_const_contents/constant.PI.html '; // 3.14159274f32' pub use std::f32::consts::PI; diff --git a/tests/rustdoc/sidebar-all-page.rs b/tests/rustdoc/sidebar-all-page.rs index 45a6ba8ed..4c8a0f543 100644 --- a/tests/rustdoc/sidebar-all-page.rs +++ b/tests/rustdoc/sidebar-all-page.rs @@ -1,5 +1,4 @@ #![crate_name = "foo"] - #![feature(rustc_attrs)] // @has 'foo/all.html' @@ -9,7 +8,7 @@ // @has - '//*[@class="sidebar-elems"]//li' 'Functions' // @has - '//*[@class="sidebar-elems"]//li' 'Traits' // @has - '//*[@class="sidebar-elems"]//li' 'Macros' -// @has - '//*[@class="sidebar-elems"]//li' 'Type Definitions' +// @has - '//*[@class="sidebar-elems"]//li' 'Type Aliases' // @has - '//*[@class="sidebar-elems"]//li' 'Constants' // @has - '//*[@class="sidebar-elems"]//li' 'Statics' // @has - '//*[@class="sidebar-elems"]//li' 'Primitive Types' @@ -26,7 +25,7 @@ pub fn foo() {} pub trait Trait {} #[macro_export] macro_rules! foo { - () => {} + () => {}; } pub type Type = u8; pub const FOO: u8 = 0; diff --git a/tests/rustdoc/titles.rs b/tests/rustdoc/titles.rs index e1feb1cd6..f6a059de6 100644 --- a/tests/rustdoc/titles.rs +++ b/tests/rustdoc/titles.rs @@ -30,7 +30,7 @@ pub struct FooStruct; // @matches 'foo/enum.FooEnum.html' '//h2[@class="location"]' 'FooEnum' pub enum FooEnum {} -// @matches 'foo/type.FooType.html' '//h1' 'Type Definition foo::FooType' +// @matches 'foo/type.FooType.html' '//h1' 'Type Alias foo::FooType' // @matches 'foo/type.FooType.html' '//h2[@class="location"]' 'FooType' pub type FooType = FooStruct; diff --git a/tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs b/tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs new file mode 100644 index 000000000..ff84352d7 --- /dev/null +++ b/tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs @@ -0,0 +1,34 @@ +#![crate_name = "inner_types_lazy"] + +#![feature(lazy_type_alias)] +#![allow(incomplete_features)] + +// @has 'inner_types_lazy/struct.Pair.html' +pub struct Pair { + pub first: A, + pub second: B, +} + +// @has 'inner_types_lazy/type.ReversedTypesPair.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 1 +// @count - '//span[@class="where fmt-newline"]' 0 +pub type ReversedTypesPair = Pair; + +// @has 'inner_types_lazy/type.ReadWrite.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 1 +// @count - '//span[@class="where fmt-newline"]' 2 +pub type ReadWrite = Pair +where + R: std::io::Read, + W: std::io::Write; + +// @has 'inner_types_lazy/type.VecPair.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 1 +// @count - '//span[@class="where fmt-newline"]' 0 +pub type VecPair = Pair, Vec>; diff --git a/tests/rustdoc/typedef-inner-variants.rs b/tests/rustdoc/typedef-inner-variants.rs new file mode 100644 index 000000000..b734714fd --- /dev/null +++ b/tests/rustdoc/typedef-inner-variants.rs @@ -0,0 +1,119 @@ +// This test checks different combinations of structs, enums, and unions +// for the "Show Aliased Type" feature on type definition. + +#![crate_name = "inner_variants"] + +// aux-build:cross_crate_generic_typedef.rs +extern crate cross_crate_generic_typedef; + +pub struct Adt; +pub struct Ty; +pub struct TyCtxt; + +pub trait Interner { + type Adt; + type Ty; +} + +impl Interner for TyCtxt { + type Adt = Adt; + type Ty = Ty; +} + +// @has 'inner_variants/type.AliasTy.html' +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 0 +pub type AliasTy = Ty; + +// @has 'inner_variants/enum.IrTyKind.html' +pub enum IrTyKind { + /// Doc comment for AdtKind + AdtKind(I::Adt), + /// and another one for TyKind + TyKind(I::Adt, ::Ty), + // no comment + StructKind { a: A, }, + #[doc(hidden)] + Unspecified, +} + +// @has 'inner_variants/type.NearlyTyKind.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 1 +// @count - '//*[@id="fields"]' 0 +pub type NearlyTyKind = IrTyKind; + +// @has 'inner_variants/type.TyKind.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 1 +// @count - '//*[@id="fields"]' 0 +// @count - '//*[@class="variant"]' 3 +// @matches - '//pre[@class="rust item-decl"]//code' "enum TyKind" +// @has - '//pre[@class="rust item-decl"]//code/a[1]' "Adt" +// @has - '//pre[@class="rust item-decl"]//code/a[2]' "Adt" +// @has - '//pre[@class="rust item-decl"]//code/a[3]' "Ty" +// @has - '//pre[@class="rust item-decl"]//code/a[4]' "i64" +pub type TyKind = IrTyKind; + +// @has 'inner_variants/union.OneOr.html' +pub union OneOr { + pub one: i64, + pub or: A, +} + +// @has 'inner_variants/type.OneOrF64.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 1 +// @count - '//*[@class="structfield small-section-header"]' 2 +// @matches - '//pre[@class="rust item-decl"]//code' "union OneOrF64" +pub type OneOrF64 = OneOr; + +// @has 'inner_variants/struct.One.html' +pub struct One { + pub val: T, + #[doc(hidden)] + pub __hidden: T, + __private: T, +} + +// @has 'inner_variants/type.OneU64.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 1 +// @count - '//*[@class="structfield small-section-header"]' 1 +// @matches - '//pre[@class="rust item-decl"]//code' "struct OneU64" +// @matches - '//pre[@class="rust item-decl"]//code' "pub val" +pub type OneU64 = One; + +// @has 'inner_variants/struct.OnceA.html' +pub struct OnceA<'a, A> { + pub a: &'a A, +} + +// @has 'inner_variants/type.Once.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 1 +// @matches - '//pre[@class="rust item-decl"]//code' "struct Once<'a>" +// @matches - '//pre[@class="rust item-decl"]//code' "&'a" +pub type Once<'a> = OnceA<'a, i64>; + +// @has 'inner_variants/struct.HighlyGenericStruct.html' +pub struct HighlyGenericStruct { + pub z: (A, B, C, D) +} + +// @has 'inner_variants/type.HighlyGenericAABB.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 1 +// @matches - '//pre[@class="rust item-decl"]//code' "struct HighlyGenericAABB" +// @matches - '//pre[@class="rust item-decl"]//code' "pub z" +pub type HighlyGenericAABB = HighlyGenericStruct; + +// @has 'inner_variants/type.InlineU64.html' +// @count - '//*[@id="aliased-type"]' 1 +// @count - '//*[@id="variants"]' 0 +// @count - '//*[@id="fields"]' 1 +pub use cross_crate_generic_typedef::InlineU64; diff --git a/tests/rustdoc/where.SWhere_Simd_item-decl.html b/tests/rustdoc/where.SWhere_Simd_item-decl.html index 3e72ba2b7..46708b9e4 100644 --- a/tests/rustdoc/where.SWhere_Simd_item-decl.html +++ b/tests/rustdoc/where.SWhere_Simd_item-decl.html @@ -1,3 +1,3 @@ -
pub struct Simd<T>(_)
+
pub struct Simd<T>(/* private fields */)
 where
     T: MyTrait;
diff --git a/tests/rustdoc/where.alpha_trait_decl.html b/tests/rustdoc/where.alpha_trait_decl.html index a7700055c..0c0b2d1ce 100644 --- a/tests/rustdoc/where.alpha_trait_decl.html +++ b/tests/rustdoc/where.alpha_trait_decl.html @@ -1,3 +1,3 @@ -pub struct Alpha<A>(_) +pub struct Alpha<A>(/* private fields */) where A: MyTrait; \ No newline at end of file diff --git a/tests/rustdoc/where.rs b/tests/rustdoc/where.rs index 2aa9c8b54..aea02c140 100644 --- a/tests/rustdoc/where.rs +++ b/tests/rustdoc/where.rs @@ -4,7 +4,7 @@ use std::io::Lines; pub trait MyTrait { fn dummy(&self) { } } -// @has foo/struct.Alpha.html '//pre' "pub struct Alpha(_) where A: MyTrait" +// @has foo/struct.Alpha.html '//pre' "pub struct Alpha(/* private fields */) where A: MyTrait" // @snapshot alpha_trait_decl - '//*[@class="rust item-decl"]/code' pub struct Alpha(A) where A: MyTrait; // @has foo/trait.Bravo.html '//pre' "pub trait Bravowhere B: MyTrait" -- cgit v1.2.3