diff options
Diffstat (limited to 'tests/rustdoc')
122 files changed, 961 insertions, 184 deletions
diff --git a/tests/rustdoc/issue-25001.rs b/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs index 268fae594..ffb0765d3 100644 --- a/tests/rustdoc/issue-25001.rs +++ b/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/25001 +#![crate_name="issue_25001"] + // @has issue_25001/struct.Foo.html pub struct Foo<T>(T); diff --git a/tests/rustdoc/issue-28478.rs b/tests/rustdoc/anchor-id-trait-tymethod-28478.rs index 497276e68..5685040dc 100644 --- a/tests/rustdoc/issue-28478.rs +++ b/tests/rustdoc/anchor-id-trait-tymethod-28478.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/28478 +#![crate_name="issue_28478"] + #![feature(associated_type_defaults)] // @has issue_28478/trait.Bar.html diff --git a/tests/rustdoc/async-trait-sig.rs b/tests/rustdoc/async-trait-sig.rs index 2578bc8f7..db1848f71 100644 --- a/tests/rustdoc/async-trait-sig.rs +++ b/tests/rustdoc/async-trait-sig.rs @@ -1,6 +1,5 @@ // edition:2021 -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] pub trait Foo { diff --git a/tests/rustdoc/async-trait.rs b/tests/rustdoc/async-trait.rs index a473e4674..8de95aac2 100644 --- a/tests/rustdoc/async-trait.rs +++ b/tests/rustdoc/async-trait.rs @@ -1,7 +1,6 @@ // aux-build:async-trait-dep.rs // edition:2021 -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] extern crate async_trait_dep; diff --git a/tests/rustdoc/auxiliary/async-trait-dep.rs b/tests/rustdoc/auxiliary/async-trait-dep.rs index 10a55dd02..d455ee99e 100644 --- a/tests/rustdoc/auxiliary/async-trait-dep.rs +++ b/tests/rustdoc/auxiliary/async-trait-dep.rs @@ -1,6 +1,5 @@ // edition:2021 -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] pub trait Meow { diff --git a/tests/rustdoc/auxiliary/enum-variant.rs b/tests/rustdoc/auxiliary/enum-variant.rs new file mode 100644 index 000000000..a0a7fd894 --- /dev/null +++ b/tests/rustdoc/auxiliary/enum-variant.rs @@ -0,0 +1,48 @@ +#![crate_name = "bar"] + +pub enum E { + A = 12, + B, + C = 1245, +} + +pub enum F { + A, + B, +} + +#[repr(u32)] +pub enum G { + A = 12, + B, + C(u32), +} + +pub enum H { + A, + C(u32), +} + +#[repr(C)] +pub enum N { + A, + B, +} + +#[repr(C)] +pub enum O { + A(u32), + B, +} + +#[repr(u32)] +pub enum P { + A, + B, +} + +#[repr(u32)] +pub enum Q { + A(u32), + B, +} diff --git a/tests/rustdoc/issue-29503.rs b/tests/rustdoc/blanket-impl-29503.rs index 01ae44385..d6a132e1c 100644 --- a/tests/rustdoc/issue-29503.rs +++ b/tests/rustdoc/blanket-impl-29503.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/29503 +#![crate_name="issue_29503"] + use std::fmt; // @has issue_29503/trait.MyTrait.html diff --git a/tests/rustdoc/blanket-reexport-item.rs b/tests/rustdoc/blanket-reexport-item.rs index 437f0001f..315a38c30 100644 --- a/tests/rustdoc/blanket-reexport-item.rs +++ b/tests/rustdoc/blanket-reexport-item.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-S"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T' +// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-T"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T' pub struct S2 {} mod m { pub struct S {} diff --git a/tests/rustdoc/const-effect-param.rs b/tests/rustdoc/const-effect-param.rs index f50a9b96d..b6379c05a 100644 --- a/tests/rustdoc/const-effect-param.rs +++ b/tests/rustdoc/const-effect-param.rs @@ -1,3 +1,5 @@ +// Check that we don't render host effect parameters & arguments. + #![crate_name = "foo"] #![feature(effects, const_trait_impl)] diff --git a/tests/rustdoc/const-generics/add-impl.rs b/tests/rustdoc/const-generics/add-impl.rs index 195e47bc8..df490d2c6 100644 --- a/tests/rustdoc/const-generics/add-impl.rs +++ b/tests/rustdoc/const-generics/add-impl.rs @@ -7,7 +7,7 @@ pub struct Simd<T, const WIDTH: usize> { inner: T, } -// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add<Simd<u8, 16>> for Simd<u8, 16>' +// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add for Simd<u8, 16>' impl Add for Simd<u8, 16> { type Output = Self; diff --git a/tests/rustdoc/const-generics/const-impl.rs b/tests/rustdoc/const-generics/const-impl.rs index 152b643bf..f4eefcc1c 100644 --- a/tests/rustdoc/const-generics/const-impl.rs +++ b/tests/rustdoc/const-generics/const-impl.rs @@ -2,7 +2,9 @@ #![feature(adt_const_params)] #![crate_name = "foo"] -#[derive(PartialEq, Eq)] +use std::marker::ConstParamTy; + +#[derive(PartialEq, Eq, ConstParamTy)] pub enum Order { Sorted, Unsorted, @@ -31,7 +33,7 @@ impl<T> VSet<T, { Order::Unsorted }> { pub struct Escape<const S: &'static str>; -// @has foo/struct.Escape.html '//*[@id="impl-Escape%3Cr%23%22%3Cscript%3Ealert(%22Escape%22);%3C/script%3E%22%23%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>' +// @has foo/struct.Escape.html '//*[@id="impl-Escape%3C%22%3Cscript%3Ealert(%5C%22Escape%5C%22);%3C/script%3E%22%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>' impl Escape<r#"<script>alert("Escape");</script>"#> { pub fn f() {} } diff --git a/tests/rustdoc/issue-33302.rs b/tests/rustdoc/const-rendering-macros-33302.rs index a316f3ad9..0f5cb9214 100644 --- a/tests/rustdoc/issue-33302.rs +++ b/tests/rustdoc/const-rendering-macros-33302.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/33302 +#![crate_name="issue_33302"] + // Ensure constant and array length values are not taken from source // code, which wreaks havoc with macros. diff --git a/tests/rustdoc/crate-version-escape.rs b/tests/rustdoc/crate-version-escape.rs index 8413709f1..f134d9baa 100644 --- a/tests/rustdoc/crate-version-escape.rs +++ b/tests/rustdoc/crate-version-escape.rs @@ -2,4 +2,4 @@ #![crate_name = "foo"] -// @has 'foo/index.html' '//li[@class="version"]' 'Version <script>alert("hi")</script>' +// @has 'foo/index.html' '//*[@class="version"]' '<script>alert("hi")</script>' diff --git a/tests/rustdoc/crate-version-extra.rs b/tests/rustdoc/crate-version-extra.rs new file mode 100644 index 000000000..72a2c4ba5 --- /dev/null +++ b/tests/rustdoc/crate-version-extra.rs @@ -0,0 +1,7 @@ +// compile-flags: '--crate-version=1.3.37-nightly (203c57dbe 2023-09-17)' + +#![crate_name="foo"] + +// main version next to logo, extra version data below it +// @has 'foo/index.html' '//h2/span[@class="version"]' '1.3.37-nightly' +// @has 'foo/index.html' '//nav[@class="sidebar"]/div[@class="version"]' '(203c57dbe 2023-09-17)' diff --git a/tests/rustdoc/crate-version.rs b/tests/rustdoc/crate-version.rs index 2592c9853..d4be845b7 100644 --- a/tests/rustdoc/crate-version.rs +++ b/tests/rustdoc/crate-version.rs @@ -1,3 +1,3 @@ // compile-flags: --crate-version=1.3.37 -// @has 'crate_version/index.html' '//*[@class="version"]' 'Version 1.3.37' +// @has 'crate_version/index.html' '//*[@class="version"]' '1.3.37' diff --git a/tests/rustdoc/decl-trailing-whitespace.declaration.html b/tests/rustdoc/decl-trailing-whitespace.declaration.html index d73393633..59c318c16 100644 --- a/tests/rustdoc/decl-trailing-whitespace.declaration.html +++ b/tests/rustdoc/decl-trailing-whitespace.declaration.html @@ -1,22 +1,16 @@ <code>pub trait Write { // Required methods fn <a href="#tymethod.poll_write" class="fn">poll_write</a>( - self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + self, cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, buf: &mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>] ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; -<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>( - self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, - cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> - ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; -<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>( - self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, - cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> - ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; +<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>(self, cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; +<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>(self, cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; // Provided method fn <a href="#method.poll_write_vectored" class="fn">poll_write_vectored</a>( - self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + self, cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, bufs: &[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>] ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>> { ... } diff --git a/tests/rustdoc/decl-trailing-whitespace.rs b/tests/rustdoc/decl-trailing-whitespace.rs index d2a12435d..667837743 100644 --- a/tests/rustdoc/decl-trailing-whitespace.rs +++ b/tests/rustdoc/decl-trailing-whitespace.rs @@ -9,21 +9,21 @@ pub struct Error; pub trait Write { // @snapshot 'declaration' - '//*[@class="rust item-decl"]//code' fn poll_write( - self: Option<String>, + self, cx: &mut Option<String>, buf: &mut [usize] ) -> Option<Result<usize, Error>>; fn poll_flush( - self: Option<String>, + self, cx: &mut Option<String> ) -> Option<Result<(), Error>>; fn poll_close( - self: Option<String>, + self, cx: &mut Option<String>, ) -> Option<Result<(), Error>>; fn poll_write_vectored( - self: Option<String>, + self, cx: &mut Option<String>, bufs: &[usize] ) -> Option<Result<usize, Error>> {} diff --git a/tests/rustdoc/issue-21474.rs b/tests/rustdoc/deduplicate-glob-import-impl-21474.rs index 5de26abac..2a675b4b6 100644 --- a/tests/rustdoc/issue-21474.rs +++ b/tests/rustdoc/deduplicate-glob-import-impl-21474.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/21474 +#![crate_name="issue_21474"] + pub use inner::*; mod inner { diff --git a/tests/rustdoc/issue-22025.rs b/tests/rustdoc/deduplicate-trait-impl-22025.rs index a721a15f4..65a556e3a 100644 --- a/tests/rustdoc/issue-22025.rs +++ b/tests/rustdoc/deduplicate-trait-impl-22025.rs @@ -1,6 +1,9 @@ // aux-build:issue-22025.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/22025 +#![crate_name="issue_22025"] + extern crate issue_22025; pub use issue_22025::foo::{Foo, Bar}; diff --git a/tests/rustdoc/deprecated-future-staged-api.rs b/tests/rustdoc/deprecated-future-staged-api.rs index 2670e7f5d..09120b8d4 100644 --- a/tests/rustdoc/deprecated-future-staged-api.rs +++ b/tests/rustdoc/deprecated-future-staged-api.rs @@ -1,12 +1,12 @@ #![feature(staged_api)] -#![stable(feature = "deprecated-future-staged-api", since = "1.0.0")] +#![stable(feature = "deprecated_future_staged_api", since = "1.0.0")] // @has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \ // 'Deprecation planned' // @has deprecated_future_staged_api/struct.S1.html '//*[@class="stab deprecated"]' \ // 'Deprecating in 99.99.99: effectively never' #[deprecated(since = "99.99.99", note = "effectively never")] -#[stable(feature = "deprecated-future-staged-api", since = "1.0.0")] +#[stable(feature = "deprecated_future_staged_api", since = "1.0.0")] pub struct S1; // @has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \ @@ -14,5 +14,5 @@ pub struct S1; // @has deprecated_future_staged_api/struct.S2.html '//*[@class="stab deprecated"]' \ // 'Deprecating in a future Rust version: literally never' #[deprecated(since = "TBD", note = "literally never")] -#[stable(feature = "deprecated-future-staged-api", since = "1.0.0")] +#[stable(feature = "deprecated_future_staged_api", since = "1.0.0")] pub struct S2; diff --git a/tests/rustdoc/deref/deref-mut-methods.rs b/tests/rustdoc/deref/deref-mut-methods.rs index fdf843422..65681f812 100644 --- a/tests/rustdoc/deref/deref-mut-methods.rs +++ b/tests/rustdoc/deref/deref-mut-methods.rs @@ -9,7 +9,7 @@ impl Foo { } // @has foo/struct.Bar.html -// @has - '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.foo"]' 'foo' +// @has - '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.foo"]' 'foo' pub struct Bar { foo: Foo, } diff --git a/tests/rustdoc/deref/deref-recursive-pathbuf.rs b/tests/rustdoc/deref/deref-recursive-pathbuf.rs index be2b42b5a..7aee3147b 100644 --- a/tests/rustdoc/deref/deref-recursive-pathbuf.rs +++ b/tests/rustdoc/deref/deref-recursive-pathbuf.rs @@ -8,9 +8,9 @@ // @has '-' '//*[@id="deref-methods-Path"]' 'Methods from Deref<Target = Path>' // @has '-' '//*[@class="impl-items"]//*[@id="method.exists"]' 'pub fn exists(&self)' // @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-PathBuf"]' 'Methods from Deref<Target=PathBuf>' -// @has '-' '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.as_path"]' 'as_path' +// @has '-' '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.as_path"]' 'as_path' // @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-Path"]' 'Methods from Deref<Target=Path>' -// @has '-' '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.exists"]' 'exists' +// @has '-' '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.exists"]' 'exists' #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-32890.rs b/tests/rustdoc/disambiguate-anchors-32890.rs index 970954433..d88601d65 100644 --- a/tests/rustdoc/issue-32890.rs +++ b/tests/rustdoc/disambiguate-anchors-32890.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/32890 +#![crate_name="issue_32890"] + // @has issue_32890/struct.Foo.html pub struct Foo<T>(T); diff --git a/tests/rustdoc/issue-29449.rs b/tests/rustdoc/disambiguate-anchors-header-29449.rs index 0d829cf6f..38a4954fc 100644 --- a/tests/rustdoc/issue-29449.rs +++ b/tests/rustdoc/disambiguate-anchors-header-29449.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/29449 +#![crate_name="issue_29449"] + // @has issue_29449/struct.Foo.html pub struct Foo; diff --git a/tests/rustdoc/issue-33069.rs b/tests/rustdoc/doc-hidden-trait-implementors-33069.rs index 0213a53ca..35570668e 100644 --- a/tests/rustdoc/issue-33069.rs +++ b/tests/rustdoc/doc-hidden-trait-implementors-33069.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/33069 +#![crate_name="issue_33069"] + pub trait Bar {} #[doc(hidden)] diff --git a/tests/rustdoc/issue-30252.rs b/tests/rustdoc/doctest-cfg-feature-30252.rs index c3777362a..ceb8076fe 100644 --- a/tests/rustdoc/issue-30252.rs +++ b/tests/rustdoc/doctest-cfg-feature-30252.rs @@ -1,5 +1,8 @@ // compile-flags:--test --cfg feature="bar" +// https://github.com/rust-lang/rust/issues/30252 +#![crate_name="issue_30252"] + /// ```rust /// assert_eq!(cfg!(feature = "bar"), true); /// ``` diff --git a/tests/rustdoc/doctest-hide-empty-line-23106.rs b/tests/rustdoc/doctest-hide-empty-line-23106.rs new file mode 100644 index 000000000..8e1e2cf09 --- /dev/null +++ b/tests/rustdoc/doctest-hide-empty-line-23106.rs @@ -0,0 +1,10 @@ +// compile-flags:--test + +// https://github.com/rust-lang/rust/issues/23106 +#![crate_name="issue_23106"] + +/// ``` +/// # +/// ``` +pub fn main() { +} diff --git a/tests/rustdoc/issue-32556.rs b/tests/rustdoc/doctest-ignore-32556.rs index e1cf11509..99da9358b 100644 --- a/tests/rustdoc/issue-32556.rs +++ b/tests/rustdoc/doctest-ignore-32556.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/32556 +#![crate_name="issue_32556"] + /// Blah blah blah /// ```ignore (testing rustdoc's handling of ignore) /// bad_assert!(); diff --git a/tests/rustdoc/issue-23744.rs b/tests/rustdoc/doctest-markdown-inline-parse-23744.rs index 642817396..128e2daba 100644 --- a/tests/rustdoc/issue-23744.rs +++ b/tests/rustdoc/doctest-markdown-inline-parse-23744.rs @@ -1,5 +1,8 @@ // compile-flags:--test +// https://github.com/rust-lang/rust/issues/23744 +#![crate_name="issue_23744"] + /// Example of rustdoc incorrectly parsing <code>```rust,should_panic</code>. /// /// ```should_panic diff --git a/tests/rustdoc/issue-25944.rs b/tests/rustdoc/doctest-multi-line-string-literal-25944.rs index 49625294b..eec796e4f 100644 --- a/tests/rustdoc/issue-25944.rs +++ b/tests/rustdoc/doctest-multi-line-string-literal-25944.rs @@ -1,5 +1,8 @@ // compile-flags:--test +// https://github.com/rust-lang/rust/issues/25944 +#![crate_name="issue_25944"] + /// ``` /// let a = r#" /// foo diff --git a/tests/rustdoc/enum-variant-value.rs b/tests/rustdoc/enum-variant-value.rs new file mode 100644 index 000000000..096f8cd41 --- /dev/null +++ b/tests/rustdoc/enum-variant-value.rs @@ -0,0 +1,191 @@ +// This test ensures that the variant value is displayed with underscores but without +// a type name at the end. + +// aux-build:enum-variant.rs + +#![crate_name = "foo"] + +extern crate bar; + +// In this case, since all variants are C-like variants and at least one of them +// has its value set, we display values for all of them. + +// @has 'foo/enum.A.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 12,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 13,' +// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 12$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 13$' +// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$' +pub enum A { + A = 12, + B, + C = 1245, +} + +// In this case, all variants are C-like variants but none of them has its value set. +// Therefore we don't display values. + +// @has 'foo/enum.B.html' +// @has - '//*[@class="rust item-decl"]/code' 'A,' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @matches - '//*[@id="variant.A"]/h3' '^A$' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +pub enum B { + A, + B, +} + +// In this case, not all variants are C-like variants so we don't display values. + +// @has 'foo/enum.C.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 12,' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@class="rust item-decl"]/code' 'C(u32),' +// @matches - '//*[@id="variant.A"]/h3' '^A = 12$' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +// @has - '//*[@id="variant.C"]/h3' 'C(u32)' +#[repr(u32)] +pub enum C { + A = 12, + B, + C(u32), +} + +// In this case, not all variants are C-like variants and no C-like variant has its +// value set, so we don't display values. + +// @has 'foo/enum.D.html' +// @has - '//*[@class="rust item-decl"]/code' 'A,' +// @has - '//*[@class="rust item-decl"]/code' 'C(u32),' +// @matches - '//*[@id="variant.A"]/h3' '^A$' +// @has - '//*[@id="variant.C"]/h3' 'C(u32)' +pub enum D { + A, + C(u32), +} + +// @has 'foo/enum.E.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 12,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 13,' +// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 12$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 13$' +// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$' +pub use bar::E; + +// @has 'foo/enum.F.html' +// @has - '//*[@class="rust item-decl"]/code' 'A,' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @matches - '//*[@id="variant.A"]/h3' '^A$' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +pub use bar::F; + +// @has 'foo/enum.G.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 12,' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@class="rust item-decl"]/code' 'C(u32),' +// @matches - '//*[@id="variant.A"]/h3' '^A = 12$' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +// @has - '//*[@id="variant.C"]/h3' 'C(u32)' +pub use bar::G; + +// @has 'foo/enum.H.html' +// @has - '//*[@class="rust item-decl"]/code' 'A,' +// @has - '//*[@class="rust item-decl"]/code' 'C(u32),' +// @matches - '//*[@id="variant.A"]/h3' '^A$' +// @has - '//*[@id="variant.C"]/h3' 'C(u32)' +pub use bar::H; + +// Testing more complex cases. +pub const X: isize = 2; +// @has 'foo/enum.I.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 2,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 4,' +// @has - '//*[@class="rust item-decl"]/code' 'C = 9,' +// @has - '//*[@class="rust item-decl"]/code' 'D = -1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 2$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 4$' +// @matches - '//*[@id="variant.C"]/h3' '^C = 9$' +// @matches - '//*[@id="variant.D"]/h3' '^D = -1$' +#[repr(isize)] +pub enum I { + A = X, + B = X * 2, + C = Self::B as isize + X + 3, + D = -1, +} + +// Testing `repr`. + +// @has 'foo/enum.J.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 0,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 0$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 1$' +#[repr(C)] +pub enum J { + A, + B, +} + +// @has 'foo/enum.K.html' +// @has - '//*[@class="rust item-decl"]/code' 'A(u32),' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@id="variant.A"]/h3' 'A(u32)' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +#[repr(C)] +pub enum K { + A(u32), + B, +} + +// @has 'foo/enum.L.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 0,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 0$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 1$' +#[repr(u32)] +pub enum L { + A, + B, +} + +// @has 'foo/enum.M.html' +// @has - '//*[@class="rust item-decl"]/code' 'A(u32),' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@id="variant.A"]/h3' 'A(u32)' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +#[repr(u32)] +pub enum M { + A(u32), + B, +} + +// @has 'foo/enum.N.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 0,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 0$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 1$' +pub use bar::N; + +// @has 'foo/enum.O.html' +// @has - '//*[@class="rust item-decl"]/code' 'A(u32),' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@id="variant.A"]/h3' 'A(u32)' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +pub use bar::O; + +// @has 'foo/enum.P.html' +// @has - '//*[@class="rust item-decl"]/code' 'A = 0,' +// @has - '//*[@class="rust item-decl"]/code' 'B = 1,' +// @matches - '//*[@id="variant.A"]/h3' '^A = 0$' +// @matches - '//*[@id="variant.B"]/h3' '^B = 1$' +pub use bar::P; + +// @has 'foo/enum.Q.html' +// @has - '//*[@class="rust item-decl"]/code' 'A(u32),' +// @has - '//*[@class="rust item-decl"]/code' 'B,' +// @has - '//*[@id="variant.A"]/h3' 'A(u32)' +// @matches - '//*[@id="variant.B"]/h3' '^B$' +pub use bar::Q; diff --git a/tests/rustdoc/issue-22038.rs b/tests/rustdoc/extern-fn-22038.rs index de6cc7870..72d39c32a 100644 --- a/tests/rustdoc/issue-22038.rs +++ b/tests/rustdoc/extern-fn-22038.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/22038 +#![crate_name="issue_22038"] + extern "C" { // @has issue_22038/fn.foo1.html \ // '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn foo1()' diff --git a/tests/rustdoc/generic-impl.rs b/tests/rustdoc/generic-impl.rs index 6f68b1574..f62540c6b 100644 --- a/tests/rustdoc/generic-impl.rs +++ b/tests/rustdoc/generic-impl.rs @@ -5,9 +5,9 @@ use std::fmt; // @!has foo/struct.Bar.html '//*[@id="impl-ToString-for-Bar"]' '' pub struct Bar; -// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-Foo"]//h3[@class="code-header"]' 'impl<T> ToString for T' +// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-T"]//h3[@class="code-header"]' 'impl<T> ToString for T' pub struct Foo; -// @has foo/struct.Foo.html '//*[@class="sidebar-elems"]//section//a[@href="#impl-ToString-for-Foo"]' 'ToString' +// @has foo/struct.Foo.html '//*[@class="sidebar-elems"]//section//a[@href="#impl-ToString-for-T"]' 'ToString' impl fmt::Display for Foo { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/tests/rustdoc/issue-34025.rs b/tests/rustdoc/hidden-extern-34025.rs index 9b9f21cb3..81ccf2a0e 100644 --- a/tests/rustdoc/issue-34025.rs +++ b/tests/rustdoc/hidden-extern-34025.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/34025 #![crate_name = "foo"] // @!has 'foo/sys/index.html' diff --git a/tests/rustdoc/hidden-impls.rs b/tests/rustdoc/hidden-impls.rs index 26e2e0e06..3283fbfec 100644 --- a/tests/rustdoc/hidden-impls.rs +++ b/tests/rustdoc/hidden-impls.rs @@ -12,6 +12,6 @@ pub mod __hidden { // @has foo/trait.Clone.html // @!hasraw - 'Foo' -// @has implementors/core/clone/trait.Clone.js +// @has trait.impl/core/clone/trait.Clone.js // @!hasraw - 'Foo' pub use std::clone::Clone; diff --git a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs index 6006354eb..d728f772a 100644 --- a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs +++ b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs @@ -4,9 +4,11 @@ // // Read the documentation of `rustdoc::clean::utils::print_const_expr` // for further details. -#![feature(const_trait_impl, generic_const_exprs)] +#![feature(const_trait_impl, generic_const_exprs, adt_const_params, generic_const_items)] #![allow(incomplete_features)] +use std::marker::ConstParamTy; + // @has hide_complex_unevaluated_const_arguments/trait.Stage.html pub trait Stage { // A helper constant that prevents const expressions containing it @@ -29,11 +31,13 @@ pub trait Stage { // // @has - '//*[@id="associatedconstant.ARRAY1"]' \ // 'const ARRAY1: [u8; { _ }]' - const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]; + const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)] + where [(); Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]:; // @has - '//*[@id="associatedconstant.VERBOSE"]' \ // 'const VERBOSE: [u16; { _ }]' - const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT]; + const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT] + where [(); compute("thing", 9 + 9) * Self::ABSTRACT]:; // Check that we do not leak the private struct field contained within // the path. The output could definitely be improved upon @@ -69,6 +73,7 @@ pub trait Sub: Sup<{ 90 * 20 * 4 }, { Struct { private: () } }> {} pub trait Sup<const N: usize, const S: Struct> {} +#[derive(ConstParamTy, PartialEq, Eq)] pub struct Struct { private: () } impl Struct { diff --git a/tests/rustdoc/html-no-source.rs b/tests/rustdoc/html-no-source.rs index 25615a73c..b91aa4120 100644 --- a/tests/rustdoc/html-no-source.rs +++ b/tests/rustdoc/html-no-source.rs @@ -11,20 +11,20 @@ // @files 'src/foo' '[]' // @has foo/fn.foo.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' -// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub fn foo() {} // @has foo/struct.Bar.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' -// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub struct Bar; impl Bar { - // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0' - // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·' + // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0.0' + // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0.0 ·' #[stable(feature = "foobar", since = "2.0")] pub fn bar() {} } diff --git a/tests/rustdoc/issue-28927.rs b/tests/rustdoc/ice-reexport-crate-root-28927.rs index 38a520850..26debfc60 100644 --- a/tests/rustdoc/issue-28927.rs +++ b/tests/rustdoc/ice-reexport-crate-root-28927.rs @@ -2,5 +2,8 @@ // aux-build:issue-28927-1.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/28927 +#![crate_name="issue_28927"] + pub extern crate issue_28927_1 as inner1; pub use inner1 as foo; diff --git a/tests/rustdoc/issue-21092.rs b/tests/rustdoc/impl-assoc-type-21092.rs index b054145a4..f01f098a9 100644 --- a/tests/rustdoc/issue-21092.rs +++ b/tests/rustdoc/impl-assoc-type-21092.rs @@ -1,6 +1,9 @@ // aux-build:issue-21092.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/21092 +#![crate_name="issue_21092"] + extern crate issue_21092; // @has issue_21092/struct.Bar.html diff --git a/tests/rustdoc/impl-parts-crosscrate.rs b/tests/rustdoc/impl-parts-crosscrate.rs index 34733f1f8..da109ea70 100644 --- a/tests/rustdoc/impl-parts-crosscrate.rs +++ b/tests/rustdoc/impl-parts-crosscrate.rs @@ -12,7 +12,7 @@ pub struct Bar<T> { t: T } // full impl string. Instead, just make sure something from each part // is mentioned. -// @hasraw implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar +// @hasraw trait.impl/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar // @hasraw - Send // @hasraw - !AnAutoTrait // @hasraw - Copy diff --git a/tests/rustdoc/issue-33592.rs b/tests/rustdoc/impl-type-parameter-33592.rs index 7a128f0b8..77f53710e 100644 --- a/tests/rustdoc/issue-33592.rs +++ b/tests/rustdoc/impl-type-parameter-33592.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/33592 #![crate_name = "foo"] pub trait Foo<T> {} diff --git a/tests/rustdoc/implementor-stable-version.rs b/tests/rustdoc/implementor-stable-version.rs index a1f3fd5a8..9c5b9b7e3 100644 --- a/tests/rustdoc/implementor-stable-version.rs +++ b/tests/rustdoc/implementor-stable-version.rs @@ -1,21 +1,21 @@ -#![stable(feature = "bar", since = "OLD 1.0")] +#![stable(feature = "bar", since = "3.3.3")] #![crate_name = "foo"] #![feature(staged_api)] -#[stable(feature = "bar", since = "OLD 1.0")] +#[stable(feature = "bar", since = "3.3.3")] pub trait Bar {} -#[stable(feature = "baz", since = "OLD 1.0")] +#[stable(feature = "baz", since = "3.3.3")] pub trait Baz {} -#[stable(feature = "baz", since = "OLD 1.0")] +#[stable(feature = "baz", since = "3.3.3")] pub struct Foo; -// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' 'NEW 2.0' -#[stable(feature = "foobar", since = "NEW 2.0")] +// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' '4.4.4' +#[stable(feature = "foobar", since = "4.4.4")] impl Bar for Foo {} -// @!has foo/trait.Baz.html '//div[@id="implementors-list"]//span[@class="since"]' 'OLD 1.0' -#[stable(feature = "foobaz", since = "OLD 1.0")] +// @!has foo/trait.Baz.html '//div[@id="implementors-list"]//span[@class="since"]' '3.3.3' +#[stable(feature = "foobaz", since = "3.3.3")] impl Baz for Foo {} diff --git a/tests/rustdoc/inline_cross/attributes.rs b/tests/rustdoc/inline_cross/attributes.rs new file mode 100644 index 000000000..c0b75c48f --- /dev/null +++ b/tests/rustdoc/inline_cross/attributes.rs @@ -0,0 +1,7 @@ +// aux-crate:attributes=attributes.rs +// edition:2021 +#![crate_name = "user"] + +// @has 'user/struct.NonExhaustive.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[non_exhaustive]' +pub use attributes::NonExhaustive; diff --git a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs index 767564ed1..564ca7d67 100644 --- a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs +++ b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs @@ -1,4 +1,3 @@ -#![feature(async_fn_in_trait)] // edition: 2021 pub async fn load() -> i32 { diff --git a/tests/rustdoc/inline_cross/auxiliary/attributes.rs b/tests/rustdoc/inline_cross/auxiliary/attributes.rs new file mode 100644 index 000000000..c6f155d4b --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/attributes.rs @@ -0,0 +1,2 @@ +#[non_exhaustive] +pub struct NonExhaustive; diff --git a/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs b/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs new file mode 100644 index 000000000..b0c21ffae --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs @@ -0,0 +1,16 @@ +#![feature(effects, const_trait_impl)] + +#[const_trait] +pub trait Resource {} + +pub const fn load<R: ~const Resource>() -> i32 { + 0 +} + +pub const fn lock<R: Resource>() {} + +#[allow(non_upper_case_globals)] +pub trait Clash<const host: u64> {} + +#[allow(non_upper_case_globals)] +pub const fn clash<T: Clash<host>, const host: u64>() {} diff --git a/tests/rustdoc/inline_cross/auxiliary/const-fn.rs b/tests/rustdoc/inline_cross/auxiliary/const-fn.rs deleted file mode 100644 index 26332b419..000000000 --- a/tests/rustdoc/inline_cross/auxiliary/const-fn.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![feature(effects)] - -pub const fn load() -> i32 { - 0 -} diff --git a/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs b/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs new file mode 100644 index 000000000..1e31f1892 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs @@ -0,0 +1,45 @@ +pub type BoxedStr = Box<str>; +pub type IntMap = std::collections::HashMap<i64, u64>; + +pub struct TyPair<T, U = T>(T, U); + +pub type T0 = TyPair<i32>; +pub type T1 = TyPair<i32, u32>; +pub type T2<K> = TyPair<i32, K>; +pub type T3<Q> = TyPair<Q, Q>; + +pub struct CtPair<const C: u32, const D: u32 = C>; + +pub type C0 = CtPair<43, 43>; +pub type C1 = CtPair<0, 1>; +pub type C2 = CtPair<{1 + 2}, 3>; + +pub struct Re<'a, U = &'a ()>(&'a (), U); + +pub type R0<'q> = Re<'q>; +pub type R1<'q> = Re<'q, &'q ()>; +pub type R2<'q> = Re<'q, &'static ()>; +pub type H0 = fn(for<'a> fn(Re<'a>)); +pub type H1 = for<'b> fn(for<'a> fn(Re<'a, &'b ()>)); +pub type H2 = for<'a> fn(for<'b> fn(Re<'a, &'b ()>)); + +pub struct Proj<T: Basis, U = <T as Basis>::Assoc>(T, U); +pub trait Basis { type Assoc; } +impl Basis for () { type Assoc = bool; } + +pub type P0 = Proj<()>; +pub type P1 = Proj<(), bool>; +pub type P2 = Proj<(), ()>; + +pub struct Alpha<T = for<'any> fn(&'any ())>(T); + +pub type A0 = Alpha; +pub type A1 = Alpha<for<'arbitrary> fn(&'arbitrary ())>; + +pub struct Multi<A = u64, B = u64>(A, B); + +pub type M0 = Multi<u64, ()>; + +pub trait Trait<'a, T = &'a ()> {} + +pub type F = dyn for<'a> Trait<'a>; diff --git a/tests/rustdoc/inline_cross/auxiliary/fn-type.rs b/tests/rustdoc/inline_cross/auxiliary/fn-type.rs new file mode 100644 index 000000000..dacda516b --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/fn-type.rs @@ -0,0 +1 @@ +pub type F = for<'z, 'a, '_unused> fn(&'z for<'b> fn(&'b str), &'a ()) -> &'a (); diff --git a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs index 42cfc3dc3..fa61312eb 100644 --- a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs +++ b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs @@ -15,7 +15,7 @@ pub fn func4<T: Iterator<Item = impl Clone>>(_x: T) {} pub fn func5( _f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>, - _a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>, + _a: impl for<'beta, 'alpha, '_gamma> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>, ) {} pub trait Other { diff --git a/tests/rustdoc/auxiliary/issue-21801.rs b/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs index 732612ff0..732612ff0 100644 --- a/tests/rustdoc/auxiliary/issue-21801.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs diff --git a/tests/rustdoc/auxiliary/issue-23207-1.rs b/tests/rustdoc/inline_cross/auxiliary/issue-23207-1.rs index 8531d5f1a..8531d5f1a 100644 --- a/tests/rustdoc/auxiliary/issue-23207-1.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-23207-1.rs diff --git a/tests/rustdoc/auxiliary/issue-23207-2.rs b/tests/rustdoc/inline_cross/auxiliary/issue-23207-2.rs index b92b16653..b92b16653 100644 --- a/tests/rustdoc/auxiliary/issue-23207-2.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-23207-2.rs diff --git a/tests/rustdoc/auxiliary/issue-27362-aux.rs b/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs index 077bdc33e..077bdc33e 100644 --- a/tests/rustdoc/auxiliary/issue-27362-aux.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs diff --git a/tests/rustdoc/auxiliary/issue-29584.rs b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs index a9b8796c0..a9b8796c0 100644 --- a/tests/rustdoc/auxiliary/issue-29584.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs diff --git a/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs b/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs new file mode 100644 index 000000000..9170be168 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs @@ -0,0 +1,10 @@ +#![feature(non_lifetime_binders)] + +pub trait Trait<T> {} + +pub fn f(_: impl for<T> Trait<T>) {} + +pub fn g<T>(_: T) +where + T: for<U> Trait<U>, +{} diff --git a/tests/rustdoc/inline_cross/auxiliary/repr.rs b/tests/rustdoc/inline_cross/auxiliary/repr.rs index 4a6648a64..35f08c11b 100644 --- a/tests/rustdoc/inline_cross/auxiliary/repr.rs +++ b/tests/rustdoc/inline_cross/auxiliary/repr.rs @@ -10,7 +10,7 @@ pub struct ReprSimd { } #[repr(transparent)] pub struct ReprTransparent { - field: u8, + pub field: u8, } #[repr(isize)] pub enum ReprIsize { @@ -20,3 +20,23 @@ pub enum ReprIsize { pub enum ReprU8 { Bla, } + +#[repr(transparent)] // private +pub struct ReprTransparentPrivField { + field: u32, // non-1-ZST field +} + +#[repr(transparent)] // public +pub struct ReprTransparentPriv1ZstFields { + marker0: Marker, + pub main: u64, // non-1-ZST field + marker1: Marker, +} + +#[repr(transparent)] // private +pub struct ReprTransparentPrivFieldPub1ZstFields { + main: [u16; 0], // non-1-ZST field + pub marker: Marker, +} + +pub struct Marker; // 1-ZST diff --git a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs index c72f01115..08a3f5176 100644 --- a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs +++ b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs @@ -1,5 +1,3 @@ -#![feature(return_position_impl_trait_in_trait)] - pub trait Trait { fn create() -> impl Iterator<Item = u64> { std::iter::empty() diff --git a/tests/rustdoc/inline_cross/const-effect-param.rs b/tests/rustdoc/inline_cross/const-effect-param.rs new file mode 100644 index 000000000..1d003e28f --- /dev/null +++ b/tests/rustdoc/inline_cross/const-effect-param.rs @@ -0,0 +1,29 @@ +// Regression test for issue #116629. +// Check that we don't render host effect parameters & arguments. + +// aux-crate:const_effect_param=const-effect-param.rs +// edition: 2021 +#![crate_name = "user"] + +// Don't render the host param on `load` and the host arg `host` passed to `Resource`. +// @has user/fn.load.html +// @has - '//pre[@class="rust item-decl"]' "pub const fn load<R>() -> i32\ +// where \ +// R: Resource" +pub use const_effect_param::load; + +// Don't render the host arg `true` passed to `Resource`. +// @has user/fn.lock.html +// @has - '//pre[@class="rust item-decl"]' "pub const fn lock<R>()\ +// where \ +// R: Resource" +pub use const_effect_param::lock; + +// Regression test for an issue introduced in PR #116670. +// Don't hide the const param `host` since it actually isn't the host effect param. +// @has user/fn.clash.html +// @has - '//pre[@class="rust item-decl"]' \ +// "pub const fn clash<T, const host: u64>()\ +// where \ +// T: Clash<host>" +pub use const_effect_param::clash; diff --git a/tests/rustdoc/issue-27362.rs b/tests/rustdoc/inline_cross/const-fn-27362.rs index 097e4e3b0..39b904662 100644 --- a/tests/rustdoc/issue-27362.rs +++ b/tests/rustdoc/inline_cross/const-fn-27362.rs @@ -1,6 +1,9 @@ // aux-build:issue-27362-aux.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/27362 +#![crate_name="issue_27362"] + extern crate issue_27362_aux; pub use issue_27362_aux::*; diff --git a/tests/rustdoc/inline_cross/const-fn.rs b/tests/rustdoc/inline_cross/const-fn.rs deleted file mode 100644 index 24934b873..000000000 --- a/tests/rustdoc/inline_cross/const-fn.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Regression test for issue #116629. -// Check that we render the correct generic params of const fn - -// aux-crate:const_fn=const-fn.rs -// edition: 2021 -#![crate_name = "user"] - -// @has user/fn.load.html -// @has - '//pre[@class="rust item-decl"]' "pub const fn load() -> i32" -pub use const_fn::load; diff --git a/tests/rustdoc/issue-23207.rs b/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs index 1a4b849ee..4e9596db5 100644 --- a/tests/rustdoc/issue-23207.rs +++ b/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs @@ -2,6 +2,9 @@ // aux-build:issue-23207-2.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/23207 +#![crate_name="issue_23207"] + extern crate issue_23207_2; // @has issue_23207/fmt/index.html diff --git a/tests/rustdoc/inline_cross/default-generic-args.rs b/tests/rustdoc/inline_cross/default-generic-args.rs new file mode 100644 index 000000000..c9a87a199 --- /dev/null +++ b/tests/rustdoc/inline_cross/default-generic-args.rs @@ -0,0 +1,104 @@ +#![crate_name = "user"] +// aux-crate:default_generic_args=default-generic-args.rs +// edition:2021 + +// @has user/type.BoxedStr.html +// @has - '//*[@class="rust item-decl"]//code' "Box<str>" +pub use default_generic_args::BoxedStr; + +// @has user/type.IntMap.html +// @has - '//*[@class="rust item-decl"]//code' "HashMap<i64, u64>" +pub use default_generic_args::IntMap; + +// @has user/type.T0.html +// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32>" +pub use default_generic_args::T0; + +// @has user/type.T1.html +// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32, u32>" +pub use default_generic_args::T1; + +// @has user/type.T2.html +// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32, K>" +pub use default_generic_args::T2; + +// @has user/type.T3.html +// @has - '//*[@class="rust item-decl"]//code' "TyPair<Q>" +pub use default_generic_args::T3; + +// @has user/type.C0.html +// @has - '//*[@class="rust item-decl"]//code' "CtPair<43>" +pub use default_generic_args::C0; + +// @has user/type.C1.html +// @has - '//*[@class="rust item-decl"]//code' "CtPair<0, 1>" +pub use default_generic_args::C1; + +// @has user/type.C2.html +// @has - '//*[@class="rust item-decl"]//code' "CtPair<default_generic_args::::C2::{constant#0}, 3>" +pub use default_generic_args::C2; + +// @has user/type.R0.html +// @has - '//*[@class="rust item-decl"]//code' "Re<'q>" +pub use default_generic_args::R0; + +// @has user/type.R1.html +// @has - '//*[@class="rust item-decl"]//code' "Re<'q>" +pub use default_generic_args::R1; + +// @has user/type.R2.html +// Check that we consider regions: +// @has - '//*[@class="rust item-decl"]//code' "Re<'q, &'static ()>" +pub use default_generic_args::R2; + +// @has user/type.H0.html +// Check that we handle higher-ranked regions correctly: +// @has - '//*[@class="rust item-decl"]//code' "fn(_: for<'a> fn(_: Re<'a>))" +pub use default_generic_args::H0; + +// @has user/type.H1.html +// Check that we don't conflate distinct universially quantified regions (#1): +// @has - '//*[@class="rust item-decl"]//code' "for<'b> fn(_: for<'a> fn(_: Re<'a, &'b ()>))" +pub use default_generic_args::H1; + +// @has user/type.H2.html +// Check that we don't conflate distinct universially quantified regions (#2): +// @has - '//*[@class="rust item-decl"]//code' "for<'a> fn(_: for<'b> fn(_: Re<'a, &'b ()>))" +pub use default_generic_args::H2; + +// @has user/type.P0.html +// @has - '//*[@class="rust item-decl"]//code' "Proj<()>" +pub use default_generic_args::P0; + +// @has user/type.P1.html +// @has - '//*[@class="rust item-decl"]//code' "Proj<(), bool>" +pub use default_generic_args::P1; + +// @has user/type.P2.html +// @has - '//*[@class="rust item-decl"]//code' "Proj<(), ()>" +pub use default_generic_args::P2; + +// @has user/type.A0.html +// Ensure that we elide generic arguments that are alpha-equivalent to their respective +// generic parameter (modulo substs) (#1): +// @has - '//*[@class="rust item-decl"]//code' "Alpha" +pub use default_generic_args::A0; + +// @has user/type.A1.html +// Ensure that we elide generic arguments that are alpha-equivalent to their respective +// generic parameter (modulo substs) (#1): +// @has - '//*[@class="rust item-decl"]//code' "Alpha" +pub use default_generic_args::A1; + +// @has user/type.M0.html +// Test that we don't elide `u64` even if it coincides with `A`'s default precisely because +// `()` is not the default of `B`. Mindlessly eliding `u64` would lead to `M<()>` which is a +// different type (`M<(), u64>` versus `M<u64, ()>`). +// @has - '//*[@class="rust item-decl"]//code' "Multi<u64, ()>" +pub use default_generic_args::M0; + +// @has user/type.F.html +// FIXME: Ideally, we would elide `&'a ()` but `'a` is an escaping bound var which we can't reason +// about at the moment since we don't keep track of bound vars. +// @has - '//*[@class="rust item-decl"]//code' "dyn for<'a> Trait<'a, &'a ()>" +pub use default_generic_args::F; diff --git a/tests/rustdoc/issue-29584.rs b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs index 4364a9649..b246e94e0 100644 --- a/tests/rustdoc/issue-29584.rs +++ b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs @@ -1,6 +1,9 @@ // aux-build:issue-29584.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/29584 +#![crate_name="issue_29584"] + extern crate issue_29584; // @has issue_29584/struct.Foo.html diff --git a/tests/rustdoc/inline_cross/dyn_trait.rs b/tests/rustdoc/inline_cross/dyn_trait.rs index 679972f03..9871be79c 100644 --- a/tests/rustdoc/inline_cross/dyn_trait.rs +++ b/tests/rustdoc/inline_cross/dyn_trait.rs @@ -75,16 +75,16 @@ pub use dyn_trait::AmbiguousBoundWrappedEarly1; pub use dyn_trait::AmbiguousBoundWrappedStatic; // @has user/type.NoBoundsWrappedDefaulted.html -// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait, Global>;" +// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait>;" pub use dyn_trait::NoBoundsWrappedDefaulted; // @has user/type.NoBoundsWrappedEarly.html -// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait + 'e, Global>;" +// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait + 'e>;" pub use dyn_trait::NoBoundsWrappedEarly; // @has user/fn.nbwl.html -// @has - '//pre[@class="rust item-decl"]' "nbwl<'l>(_: Box<dyn Trait + 'l, Global>)" +// @has - '//pre[@class="rust item-decl"]' "nbwl<'l>(_: Box<dyn Trait + 'l>)" pub use dyn_trait::no_bounds_wrapped_late as nbwl; // @has user/fn.nbwel.html -// @has - '//pre[@class="rust item-decl"]' "nbwel(_: Box<dyn Trait + '_, Global>)" +// @has - '//pre[@class="rust item-decl"]' "nbwel(_: Box<dyn Trait + '_>)" // NB: It might seem counterintuitive to display the explicitly elided lifetime `'_` here instead of // eliding it but this behavior is correct: The default is `'static` here which != `'_`. pub use dyn_trait::no_bounds_wrapped_elided as nbwel; diff --git a/tests/rustdoc/inline_cross/fn-type.rs b/tests/rustdoc/inline_cross/fn-type.rs new file mode 100644 index 000000000..e65790d3b --- /dev/null +++ b/tests/rustdoc/inline_cross/fn-type.rs @@ -0,0 +1,12 @@ +// Make sure that we print the higher-ranked parameters of cross-crate function pointer types. +// They should be rendered exactly as the user wrote it, i.e., in source order and with unused +// parameters present, not stripped. + +// aux-crate:fn_type=fn-type.rs +// edition: 2021 +#![crate_name = "user"] + +// @has user/type.F.html +// @has - '//*[@class="rust item-decl"]//code' \ +// "for<'z, 'a, '_unused> fn(_: &'z for<'b> fn(_: &'b str), _: &'a ()) -> &'a ();" +pub use fn_type::F; diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs index 5c802c514..3a2f5d160 100644 --- a/tests/rustdoc/inline_cross/impl_trait.rs +++ b/tests/rustdoc/inline_cross/impl_trait.rs @@ -4,7 +4,7 @@ extern crate impl_trait_aux; // @has impl_trait/fn.func.html -// @has - '//pre[@class="rust item-decl"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)" +// @has - '//pre[@class="rust item-decl"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)" // @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func; @@ -29,11 +29,11 @@ pub use impl_trait_aux::func4; // @has impl_trait/fn.func5.html // @has - '//pre[@class="rust item-decl"]' "func5(" // @has - '//pre[@class="rust item-decl"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>," -// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>" +// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'beta, 'alpha, '_gamma> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>" // @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func5; // @has impl_trait/struct.Foo.html -// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)" +// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)" // @!has - '//*[@id="method.method"]//h4[@class="code-header"]' 'where' pub use impl_trait_aux::Foo; diff --git a/tests/rustdoc/inline_cross/implementors-js.rs b/tests/rustdoc/inline_cross/implementors-js.rs index c79f05d8d..c17d52d0f 100644 --- a/tests/rustdoc/inline_cross/implementors-js.rs +++ b/tests/rustdoc/inline_cross/implementors-js.rs @@ -4,13 +4,13 @@ extern crate implementors_inline; -// @!has implementors/implementors_js/trait.MyTrait.js -// @has implementors/implementors_inline/my_trait/trait.MyTrait.js -// @!has implementors/implementors_inline/prelude/trait.MyTrait.js +// @!has trait.impl/implementors_js/trait.MyTrait.js +// @has trait.impl/implementors_inline/my_trait/trait.MyTrait.js +// @!has trait.impl/implementors_inline/prelude/trait.MyTrait.js // @has implementors_inline/my_trait/trait.MyTrait.html -// @has - '//script/@src' '../../implementors/implementors_inline/my_trait/trait.MyTrait.js' +// @has - '//script/@src' '../../trait.impl/implementors_inline/my_trait/trait.MyTrait.js' // @has implementors_js/trait.MyTrait.html -// @has - '//script/@src' '../implementors/implementors_inline/my_trait/trait.MyTrait.js' +// @has - '//script/@src' '../trait.impl/implementors_inline/my_trait/trait.MyTrait.js' /// When re-exporting this trait, the HTML will be inlined, /// but, vitally, the JavaScript will be located only at the /// one canonical path. diff --git a/tests/rustdoc/inline_cross/non_lifetime_binders.rs b/tests/rustdoc/inline_cross/non_lifetime_binders.rs new file mode 100644 index 000000000..9d3085c3e --- /dev/null +++ b/tests/rustdoc/inline_cross/non_lifetime_binders.rs @@ -0,0 +1,13 @@ +// aux-crate:non_lifetime_binders=non_lifetime_binders.rs +// edition: 2021 +#![crate_name = "user"] + +// @has user/fn.f.html +// @has - '//pre[@class="rust item-decl"]' "f(_: impl for<T> Trait<T>)" +pub use non_lifetime_binders::f; + +// @has user/fn.g.html +// @has - '//pre[@class="rust item-decl"]' "g<T>(_: T)\ +// where \ +// T: for<U> Trait<U>" +pub use non_lifetime_binders::g; diff --git a/tests/rustdoc/inline_cross/repr.rs b/tests/rustdoc/inline_cross/repr.rs index 9e107cee9..2f3d8f003 100644 --- a/tests/rustdoc/inline_cross/repr.rs +++ b/tests/rustdoc/inline_cross/repr.rs @@ -9,21 +9,32 @@ extern crate repr; // @has 'foo/struct.ReprC.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(C, align(8))]' -#[doc(inline)] pub use repr::ReprC; // @has 'foo/struct.ReprSimd.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(simd, packed(2))]' -#[doc(inline)] pub use repr::ReprSimd; // @has 'foo/struct.ReprTransparent.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' -#[doc(inline)] pub use repr::ReprTransparent; // @has 'foo/enum.ReprIsize.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(isize)]' -#[doc(inline)] pub use repr::ReprIsize; // @has 'foo/enum.ReprU8.html' // @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(u8)]' -#[doc(inline)] pub use repr::ReprU8; + +// Regression test for <https://github.com/rust-lang/rust/issues/90435>. +// Check that we show `#[repr(transparent)]` iff the non-1-ZST field is public or at least one +// field is public in case all fields are 1-ZST fields. + +// @has 'foo/struct.ReprTransparentPrivField.html' +// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +pub use repr::ReprTransparentPrivField; + +// @has 'foo/struct.ReprTransparentPriv1ZstFields.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +pub use repr::ReprTransparentPriv1ZstFields; + +// @has 'foo/struct.ReprTransparentPrivFieldPub1ZstFields.html' +// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +pub use repr::ReprTransparentPrivFieldPub1ZstFields; diff --git a/tests/rustdoc/issue-21801.rs b/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs index 29d2ec64c..bcbb2e9f4 100644 --- a/tests/rustdoc/issue-21801.rs +++ b/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs @@ -1,6 +1,9 @@ // aux-build:issue-21801.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/21801 +#![crate_name="issue_21801"] + extern crate issue_21801; // @has issue_21801/struct.Foo.html diff --git a/tests/rustdoc/intra-doc/prim-associated-traits.rs b/tests/rustdoc/intra-doc/prim-associated-traits.rs index 8639a24f7..71d7d2189 100644 --- a/tests/rustdoc/intra-doc/prim-associated-traits.rs +++ b/tests/rustdoc/intra-doc/prim-associated-traits.rs @@ -41,6 +41,6 @@ pub struct Number { pub u_128: u128, pub ch: char, pub boolean: bool, - pub string: str, + pub string: &'static str, pub n: !, } diff --git a/tests/rustdoc/issue-115295-macro-const-display.rs b/tests/rustdoc/issue-115295-macro-const-display.rs new file mode 100644 index 000000000..2916c7a84 --- /dev/null +++ b/tests/rustdoc/issue-115295-macro-const-display.rs @@ -0,0 +1,40 @@ +#![crate_name = "foo"] + +// @has foo/trait.Trait.html +pub trait Trait<T> {} + +// @has foo/struct.WithConst.html +pub struct WithConst<const N: usize>; + +macro_rules! spans_from_macro { + () => { + impl WithConst<42> { + pub fn new() -> Self { + Self + } + } + impl Trait<WithConst<42>> for WithConst<42> {} + impl Trait<WithConst<43>> for WithConst<{ 43 }> {} + impl Trait<WithConst<{ 44 }>> for WithConst<44> {} + pub struct Other { + pub field: WithConst<42>, + } + }; +} + +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Trait<WithConst<41>> for WithConst<41>" +impl Trait<WithConst<41>> for WithConst<41> {} + +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl WithConst<42>" +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Trait<WithConst<42>> for WithConst<42>" +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Trait<WithConst<43>> for WithConst<{ 43 }>" +// @has - '//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl Trait<WithConst<44>> for WithConst<44>" + +// @has foo/struct.Other.html +// @has - //pre "pub field: WithConst<42>" +spans_from_macro!(); diff --git a/tests/rustdoc/issue-23106.rs b/tests/rustdoc/issue-23106.rs deleted file mode 100644 index 8cda2fc33..000000000 --- a/tests/rustdoc/issue-23106.rs +++ /dev/null @@ -1,7 +0,0 @@ -// compile-flags:--test - -/// ``` -/// # -/// ``` -pub fn main() { -} diff --git a/tests/rustdoc/issue-31808.rs b/tests/rustdoc/issue-31808.rs deleted file mode 100644 index e55c5bd4f..000000000 --- a/tests/rustdoc/issue-31808.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Test that associated item impls on primitive types don't crash rustdoc - -pub trait Foo { - const BAR: usize; - type BAZ; -} - -impl Foo for () { - const BAR: usize = 0; - type BAZ = usize; -} diff --git a/tests/rustdoc/issue-43701.rs b/tests/rustdoc/issue-43701.rs index 44335e961..de772881e 100644 --- a/tests/rustdoc/issue-43701.rs +++ b/tests/rustdoc/issue-43701.rs @@ -2,4 +2,4 @@ pub use std::vec::Vec; -// @!has implementors/core/clone/trait.Clone.js +// @!has trait.impl/core/clone/trait.Clone.js diff --git a/tests/rustdoc/issue-78701.rs b/tests/rustdoc/issue-78701.rs index e3e46468f..3f1638d5f 100644 --- a/tests/rustdoc/issue-78701.rs +++ b/tests/rustdoc/issue-78701.rs @@ -6,7 +6,7 @@ // @has 'foo/struct.AnotherStruct.html' // @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3C()%3E"]' 1 -// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3CT%3E"]' 1 +// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-T"]' 1 pub trait Something {} diff --git a/tests/rustdoc/issue-33178.rs b/tests/rustdoc/link-extern-crate-33178.rs index ed643f5ae..6a63712c4 100644 --- a/tests/rustdoc/issue-33178.rs +++ b/tests/rustdoc/link-extern-crate-33178.rs @@ -3,6 +3,9 @@ // build-aux-docs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/33178 +#![crate_name="issue_33178"] + // @has issue_33178/index.html // @has - '//a[@title="mod empty"][@href="../empty/index.html"]' empty pub extern crate empty; diff --git a/tests/rustdoc/issue-30109.rs b/tests/rustdoc/link-extern-crate-item-30109.rs index e9447538a..c83234352 100644 --- a/tests/rustdoc/issue-30109.rs +++ b/tests/rustdoc/link-extern-crate-item-30109.rs @@ -2,6 +2,9 @@ // aux-build:issue-30109-1.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/30109 +#![crate_name="issue_30109"] + pub mod quux { extern crate issue_30109_1 as bar; use self::bar::Bar; diff --git a/tests/rustdoc/issue-33178-1.rs b/tests/rustdoc/link-extern-crate-title-33178.rs index 4dc425346..d2f115a38 100644 --- a/tests/rustdoc/issue-33178-1.rs +++ b/tests/rustdoc/link-extern-crate-title-33178.rs @@ -2,6 +2,9 @@ // aux-build:variant-struct.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/33178 +#![crate_name="issue_33178_1"] + // @has issue_33178_1/index.html // @!has - //a/@title empty pub extern crate empty; diff --git a/tests/rustdoc/logo-class-default.rs b/tests/rustdoc/logo-class-default.rs index d2d439199..6b46b4605 100644 --- a/tests/rustdoc/logo-class-default.rs +++ b/tests/rustdoc/logo-class-default.rs @@ -1,4 +1,4 @@ -// Note: this test is paired with logo-class.rs. -// @has logo_class_default/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' -// @has src/logo_class_default/logo-class-default.rs.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' +// Note: this test is paired with logo-class.rs and logo-class-rust.rs. +// @!has logo_class_default/struct.SomeStruct.html '//*[@class="logo-container"]/img' '' +// @!has src/logo_class_default/logo-class-default.rs.html '//*[@class="sub-logo-container"]/img' '' pub struct SomeStruct; diff --git a/tests/rustdoc/logo-class-rust.rs b/tests/rustdoc/logo-class-rust.rs new file mode 100644 index 000000000..d4f6113c0 --- /dev/null +++ b/tests/rustdoc/logo-class-rust.rs @@ -0,0 +1,7 @@ +#![feature(rustdoc_internals)] +#![allow(internal_features)] +#![doc(rust_logo)] +// Note: this test is paired with logo-class.rs and logo-class-default.rs. +// @has logo_class_rust/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' +// @has src/logo_class_rust/logo-class-rust.rs.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' +pub struct SomeStruct; diff --git a/tests/rustdoc/logo-class.rs b/tests/rustdoc/logo-class.rs index d3aa446da..d15ce134c 100644 --- a/tests/rustdoc/logo-class.rs +++ b/tests/rustdoc/logo-class.rs @@ -1,6 +1,6 @@ #![doc(html_logo_url = "https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png")] -// Note: this test is paired with logo-class-default.rs. +// Note: this test is paired with logo-class-default.rs and logo-class-rust.rs. // @has logo_class/struct.SomeStruct.html '//*[@class="logo-container"]/img[@src="https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png"]' '' // @!has logo_class/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' diff --git a/tests/rustdoc/issue-23812.rs b/tests/rustdoc/macro-doc-comment-23812.rs index 08fd1833b..57c18510b 100644 --- a/tests/rustdoc/issue-23812.rs +++ b/tests/rustdoc/macro-doc-comment-23812.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/23812 +#![crate_name="issue_23812"] + macro_rules! doc { (#[$outer:meta] mod $i:ident { #![$inner:meta] }) => ( diff --git a/tests/rustdoc/issue-27862.rs b/tests/rustdoc/markdown-table-escape-pipe-27862.rs index 77522f1be..9af75d248 100644 --- a/tests/rustdoc/issue-27862.rs +++ b/tests/rustdoc/markdown-table-escape-pipe-27862.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/27862 +#![crate_name="issue_27862"] + /// Tests | Table /// ------|------------- /// t = b | id = \|x\| x diff --git a/tests/rustdoc/normalize-assoc-item.rs b/tests/rustdoc/normalize-assoc-item.rs index c6fd5e110..d39e1b15a 100644 --- a/tests/rustdoc/normalize-assoc-item.rs +++ b/tests/rustdoc/normalize-assoc-item.rs @@ -30,7 +30,7 @@ pub fn f2() -> <isize as Trait>::X { } pub struct S { - // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.box_me_up"]' 'box_me_up: Box<S, Global>' + // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.box_me_up"]' 'box_me_up: Box<S>' pub box_me_up: <S as Trait>::X, // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.generic"]' 'generic: (usize, isize)' pub generic: <Generic<usize> as Trait>::X, @@ -76,7 +76,7 @@ extern crate inner; // @has 'normalize_assoc_item/fn.foo.html' '//pre[@class="rust item-decl"]' "pub fn foo() -> i32" pub use inner::foo; -// @has 'normalize_assoc_item/fn.h.html' '//pre[@class="rust item-decl"]' "pub fn h<T>() -> IntoIter<T, Global>" +// @has 'normalize_assoc_item/fn.h.html' '//pre[@class="rust item-decl"]' "pub fn h<T>() -> IntoIter<T>" pub fn h<T>() -> <Vec<T> as IntoIterator>::IntoIter { vec![].into_iter() } diff --git a/tests/rustdoc/not-wf-ambiguous-normalization.rs b/tests/rustdoc/not-wf-ambiguous-normalization.rs deleted file mode 100644 index 1e9f925f8..000000000 --- a/tests/rustdoc/not-wf-ambiguous-normalization.rs +++ /dev/null @@ -1,24 +0,0 @@ -// compile-flags: -Znormalize-docs - -#![feature(type_alias_impl_trait)] - -trait Allocator { - type Buffer; -} - -struct DefaultAllocator; - -// This unconstrained impl parameter causes the normalization of -// `<DefaultAllocator as Allocator>::Buffer` to be ambiguous, -// which caused an ICE with `-Znormalize-docs`. -impl<T> Allocator for DefaultAllocator { - type Buffer = (); -} - -type A = impl Fn(<DefaultAllocator as Allocator>::Buffer); - -fn foo() -> A { - |_| () -} - -fn main() {} diff --git a/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs b/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs index 3fb00c7db..6b94d7994 100644 --- a/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs +++ b/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs @@ -3,25 +3,28 @@ #![feature(no_core)] #![no_core] #[lang = "owned_box"] -pub struct Box<T>; +pub struct Box<T>(*const T); impl<T> Box<T> { pub fn new(x: T) -> Box<T> { - Box + Box(std::ptr::null()) } } +#[lang = "sized"] +trait Sized {} + #[doc(notable_trait)] pub trait FakeIterator {} impl<I: FakeIterator> FakeIterator for Box<I> {} #[lang = "pin"] -pub struct Pin<T>; +pub struct Pin<T>(T); impl<T> Pin<T> { pub fn new(x: T) -> Pin<T> { - Pin + Pin(x) } } diff --git a/tests/rustdoc/primitive/primitive-generic-impl.rs b/tests/rustdoc/primitive/primitive-generic-impl.rs index 2da8ae6ff..558336d73 100644 --- a/tests/rustdoc/primitive/primitive-generic-impl.rs +++ b/tests/rustdoc/primitive/primitive-generic-impl.rs @@ -1,7 +1,7 @@ #![feature(rustc_attrs)] #![crate_name = "foo"] -// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-i32"]//h3[@class="code-header"]' 'impl<T> ToString for T' +// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-T"]//h3[@class="code-header"]' 'impl<T> ToString for T' #[rustc_doc_primitive = "i32"] /// Some useless docs, wouhou! diff --git a/tests/rustdoc/issue-32395.rs b/tests/rustdoc/render-enum-variant-structlike-32395.rs index 5552300f9..2200d8ec6 100644 --- a/tests/rustdoc/issue-32395.rs +++ b/tests/rustdoc/render-enum-variant-structlike-32395.rs @@ -2,6 +2,9 @@ // build-aux-docs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/32395 +#![crate_name="issue_32395"] + // @has variant_struct/enum.Foo.html // @!hasraw - 'pub qux' // @!hasraw - 'pub(crate) qux' diff --git a/tests/rustdoc/repr.rs b/tests/rustdoc/repr.rs new file mode 100644 index 000000000..fbb46e126 --- /dev/null +++ b/tests/rustdoc/repr.rs @@ -0,0 +1,29 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/90435>. +// Check that we show `#[repr(transparent)]` iff the non-1-ZST field is public or at least one +// field is public in case all fields are 1-ZST fields. + +// @has 'repr/struct.ReprTransparentPrivField.html' +// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +#[repr(transparent)] // private +pub struct ReprTransparentPrivField { + field: u32, // non-1-ZST field +} + +// @has 'repr/struct.ReprTransparentPriv1ZstFields.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +#[repr(transparent)] // public +pub struct ReprTransparentPriv1ZstFields { + marker0: Marker, + pub main: u64, // non-1-ZST field + marker1: Marker, +} + +// @has 'repr/struct.ReprTransparentPub1ZstField.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +#[repr(transparent)] // public +pub struct ReprTransparentPub1ZstField { + marker0: Marker, + pub marker1: Marker, +} + +struct Marker; // 1-ZST diff --git a/tests/rustdoc/issue-23511.rs b/tests/rustdoc/search-index-primitive-inherent-method-23511.rs index 21d028424..1d0fe27e1 100644 --- a/tests/rustdoc/issue-23511.rs +++ b/tests/rustdoc/search-index-primitive-inherent-method-23511.rs @@ -2,6 +2,9 @@ #![feature(rustdoc_internals)] #![no_std] +// https://github.com/rust-lang/rust/issues/23511 +#![crate_name="issue_23511"] + pub mod str { #![rustc_doc_primitive = "str"] diff --git a/tests/rustdoc/sidebar-items.rs b/tests/rustdoc/sidebar-items.rs index 6f7afa59b..b746f6982 100644 --- a/tests/rustdoc/sidebar-items.rs +++ b/tests/rustdoc/sidebar-items.rs @@ -14,6 +14,7 @@ // @has - '//*[@class="sidebar-elems"]//section//a' 'Output' // @has - '//div[@class="sidebar-elems"]//h3/a[@href="#provided-associated-types"]' 'Provided Associated Types' // @has - '//*[@class="sidebar-elems"]//section//a' 'Extra' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#object-safety"]' 'Object Safety' pub trait Foo { const FOO: usize; const BAR: u32 = 0; @@ -24,6 +25,12 @@ pub trait Foo { fn bar() -> Self::Output; } +// @has foo/trait.Safe.html +// @!has - '//div[@class="sidebar-elems"]//h3/a[@href="#object-safety"]' '' +pub trait Safe { + fn access(&self); +} + // @has foo/struct.Bar.html // @has - '//div[@class="sidebar-elems"]//h3/a[@href="#fields"]' 'Fields' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#structfield.f"]' 'f' diff --git a/tests/rustdoc/sidebar-links-to-foreign-impl.rs b/tests/rustdoc/sidebar-links-to-foreign-impl.rs index caa17dfbb..733a18ad9 100644 --- a/tests/rustdoc/sidebar-links-to-foreign-impl.rs +++ b/tests/rustdoc/sidebar-links-to-foreign-impl.rs @@ -7,8 +7,8 @@ // @has - '//h2[@id="foreign-impls"]' 'Implementations on Foreign Types' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#impl-Foo-for-u32"]' 'u32' // @has - '//*[@id="impl-Foo-for-u32"]//h3[@class="code-header"]' 'impl Foo for u32' -// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26'a+str\"]" "&'a str" -// @has - "//*[@id=\"impl-Foo-for-%26'a+str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str" +// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26str\"]" "&'a str" +// @has - "//*[@id=\"impl-Foo-for-%26str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str" pub trait Foo {} impl Foo for u32 {} diff --git a/tests/rustdoc/source-version-separator.rs b/tests/rustdoc/source-version-separator.rs index 14580373b..7256f7315 100644 --- a/tests/rustdoc/source-version-separator.rs +++ b/tests/rustdoc/source-version-separator.rs @@ -3,23 +3,23 @@ #![feature(staged_api)] // @has foo/trait.Bar.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub trait Bar { - // @has - '//*[@id="tymethod.foo"]/*[@class="rightside"]' '3.0 · source' + // @has - '//*[@id="tymethod.foo"]/*[@class="rightside"]' '3.0.0 · source' #[stable(feature = "foobar", since = "3.0")] fn foo(); } -// @has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0 · source' +// @has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0.0 · source' // @has foo/struct.Foo.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "baz", since = "1.0")] pub struct Foo; impl Foo { - // @has - '//*[@id="method.foofoo"]/*[@class="rightside"]' '3.0 · source' + // @has - '//*[@id="method.foofoo"]/*[@class="rightside"]' '3.0.0 · source' #[stable(feature = "foobar", since = "3.0")] pub fn foofoo() {} } diff --git a/tests/rustdoc/issue-26606.rs b/tests/rustdoc/src-link-external-macro-26606.rs index d5cb2c710..de717a527 100644 --- a/tests/rustdoc/issue-26606.rs +++ b/tests/rustdoc/src-link-external-macro-26606.rs @@ -2,10 +2,13 @@ // ignore-cross-compile // build-aux-docs +// https://github.com/rust-lang/rust/issues/26606 +#![crate_name="issue_26606"] + // @has issue_26606_macro/macro.make_item.html #[macro_use] extern crate issue_26606_macro; // @has issue_26606/constant.FOO.html -// @has - '//a[@href="../src/issue_26606/issue-26606.rs.html#11"]' 'source' +// @has - '//a[@href="../src/issue_26606/src-link-external-macro-26606.rs.html#14"]' 'source' make_item!(FOO); diff --git a/tests/rustdoc/src-links-auto-impls.rs b/tests/rustdoc/src-links-auto-impls.rs index 1c8d15731..08a497d4c 100644 --- a/tests/rustdoc/src-links-auto-impls.rs +++ b/tests/rustdoc/src-links-auto-impls.rs @@ -5,8 +5,8 @@ // @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="src"]' 'source' // @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header"]' 'impl Sync for Unsized' // @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="src"]' 'source' -// @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header"]' 'impl<T> Any for T' -// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="src rightside"]' 'source' +// @has - '//*[@id="impl-Any-for-T"]/h3[@class="code-header"]' 'impl<T> Any for T' +// @has - '//*[@id="impl-Any-for-T"]//a[@class="src rightside"]' 'source' pub struct Unsized { data: [u8], } diff --git a/tests/rustdoc/issue-34274.rs b/tests/rustdoc/src-links-inlined-34274.rs index ce5be84a5..a3c9bf7e4 100644 --- a/tests/rustdoc/issue-34274.rs +++ b/tests/rustdoc/src-links-inlined-34274.rs @@ -2,6 +2,7 @@ // build-aux-docs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/34274 #![crate_name = "foo"] extern crate issue_34274; diff --git a/tests/rustdoc/issue-26995.rs b/tests/rustdoc/src-mod-path-absolute-26995.rs index fedc9f517..b67fd9b26 100644 --- a/tests/rustdoc/issue-26995.rs +++ b/tests/rustdoc/src-mod-path-absolute-26995.rs @@ -1,6 +1,9 @@ // ignore-windows // compile-flags: --no-defaults +// https://github.com/rust-lang/rust/issues/26995 +#![crate_name="issue_26995"] + // @has src/issue_26995/dev/null.html // @has issue_26995/null/index.html '//a/@href' '../../src/issue_26995/dev/null.html' #[path="/dev/null"] diff --git a/tests/rustdoc/issue-32374.rs b/tests/rustdoc/staged-api-deprecated-unstable-32374.rs index 985bf03a1..d282dea90 100644 --- a/tests/rustdoc/issue-32374.rs +++ b/tests/rustdoc/staged-api-deprecated-unstable-32374.rs @@ -1,6 +1,8 @@ +// https://github.com/rust-lang/rust/issues/32374 #![feature(staged_api)] #![doc(issue_tracker_base_url = "https://issue_url/")] #![unstable(feature = "test", issue = "32374")] +#![crate_name="issue_32374"] // @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \ // 'Deprecated' diff --git a/tests/rustdoc/issue-27759.rs b/tests/rustdoc/staged-api-feature-issue-27759.rs index 65e0f7cb8..56a45a600 100644 --- a/tests/rustdoc/issue-27759.rs +++ b/tests/rustdoc/staged-api-feature-issue-27759.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/27759 +#![crate_name="issue_27759"] + #![feature(staged_api)] #![doc(issue_tracker_base_url = "http://issue_url/")] diff --git a/tests/rustdoc/strip-enum-variant.no-not-shown.html b/tests/rustdoc/strip-enum-variant.no-not-shown.html index 782198956..e07233529 100644 --- a/tests/rustdoc/strip-enum-variant.no-not-shown.html +++ b/tests/rustdoc/strip-enum-variant.no-not-shown.html @@ -1 +1 @@ -<ul class="block"><li><a href="#variant.Shown">Shown</a></li></ul>
\ No newline at end of file +<ul class="block variant"><li><a href="#variant.Shown">Shown</a></li></ul>
\ No newline at end of file diff --git a/tests/rustdoc/strip-enum-variant.rs b/tests/rustdoc/strip-enum-variant.rs index 8753a7dc6..2512fa34b 100644 --- a/tests/rustdoc/strip-enum-variant.rs +++ b/tests/rustdoc/strip-enum-variant.rs @@ -3,7 +3,7 @@ // @!has - '//code' 'NotShown' // @has - '//code' '// some variants omitted' // Also check that `NotShown` isn't displayed in the sidebar. -// @snapshot no-not-shown - '//*[@class="sidebar-elems"]/section/*[@class="block"][1]' +// @snapshot no-not-shown - '//*[@class="sidebar-elems"]/section/*[@class="block variant"]' pub enum MyThing { Shown, #[doc(hidden)] diff --git a/tests/rustdoc/issue-27104.rs b/tests/rustdoc/strip-priv-imports-pass-27104.rs index 9f2fd9071..e400a8f50 100644 --- a/tests/rustdoc/issue-27104.rs +++ b/tests/rustdoc/strip-priv-imports-pass-27104.rs @@ -2,6 +2,9 @@ // aux-build:empty.rs // ignore-cross-compile +// https://github.com/rust-lang/rust/issues/27104 +#![crate_name="issue_27104"] + // @has issue_27104/index.html // @!hasraw - 'extern crate std' // @!hasraw - 'use std::prelude::' diff --git a/tests/rustdoc/issue-31899.rs b/tests/rustdoc/summary-codeblock-31899.rs index 3eee37446..c1b33058c 100644 --- a/tests/rustdoc/issue-31899.rs +++ b/tests/rustdoc/summary-codeblock-31899.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/31899 +#![crate_name="issue_31899"] + // @has issue_31899/index.html // @hasraw - 'Make this line a bit longer.' // @!hasraw - 'rust rust-example-rendered' diff --git a/tests/rustdoc/issue-30366.rs b/tests/rustdoc/summary-reference-link-30366.rs index c6274a058..5b9854c53 100644 --- a/tests/rustdoc/issue-30366.rs +++ b/tests/rustdoc/summary-reference-link-30366.rs @@ -1,5 +1,8 @@ // @has issue_30366/index.html '//a/@href' 'http://www.rust-lang.org/' +// https://github.com/rust-lang/rust/issues/30366 +#![crate_name="issue_30366"] + /// Describe it. [Link somewhere][1]. /// /// [1]: http://www.rust-lang.org/ diff --git a/tests/rustdoc/titles.rs b/tests/rustdoc/titles.rs index f6a059de6..f9da5a813 100644 --- a/tests/rustdoc/titles.rs +++ b/tests/rustdoc/titles.rs @@ -2,7 +2,8 @@ #![feature(rustc_attrs)] // @matches 'foo/index.html' '//h1' 'Crate foo' -// @matches 'foo/index.html' '//h2[@class="location"]' 'Crate foo' +// @matches 'foo/index.html' '//div[@class="sidebar-crate"]/h2/a' 'foo' +// @count 'foo/index.html' '//h2[@class="location"]' 0 // @matches 'foo/foo_mod/index.html' '//h1' 'Module foo::foo_mod' // @matches 'foo/foo_mod/index.html' '//h2[@class="location"]' 'Module foo_mod' diff --git a/tests/rustdoc/trait-object-safe.rs b/tests/rustdoc/trait-object-safe.rs new file mode 100644 index 000000000..818843f75 --- /dev/null +++ b/tests/rustdoc/trait-object-safe.rs @@ -0,0 +1,27 @@ +#![crate_name = "foo"] + +// @has 'foo/trait.Unsafe.html' +// @has - '//*[@class="object-safety-info"]' 'This trait is not object safe.' +// @has - '//*[@id="object-safety"]' 'Object Safety' +pub trait Unsafe { + fn foo() -> Self; +} + +// @has 'foo/trait.Unsafe2.html' +// @has - '//*[@class="object-safety-info"]' 'This trait is not object safe.' +// @has - '//*[@id="object-safety"]' 'Object Safety' +pub trait Unsafe2<T> { + fn foo(i: T); +} + +// @has 'foo/trait.Safe.html' +// @!has - '//*[@class="object-safety-info"]' '' +// @!has - '//*[@id="object-safety"]' '' +pub trait Safe { + fn foo(&self); +} + +// @has 'foo/struct.Foo.html' +// @!has - '//*[@class="object-safety-info"]' '' +// @!has - '//*[@id="object-safety"]' '' +pub struct Foo; diff --git a/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs b/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs new file mode 100644 index 000000000..3607612c2 --- /dev/null +++ b/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs @@ -0,0 +1,9 @@ +pub struct MyStruct<T>(T); + +pub trait MyTrait1 { + fn method_trait_1(); +} + +impl MyTrait1 for MyStruct<u16> { + fn method_trait_1() {} +} diff --git a/tests/rustdoc/type-alias/cross-crate-115718.rs b/tests/rustdoc/type-alias/cross-crate-115718.rs new file mode 100644 index 000000000..372e62e42 --- /dev/null +++ b/tests/rustdoc/type-alias/cross-crate-115718.rs @@ -0,0 +1,34 @@ +// aux-build: parent-crate-115718.rs + +// https://github.com/rust-lang/rust/issues/115718 +#![crate_name = "foo"] + +extern crate parent_crate_115718; + +use parent_crate_115718::MyStruct; + +pub trait MyTrait2 { + fn method_trait_2(); +} + +impl MyTrait2 for MyStruct<u16> { + fn method_trait_2() {} +} + +pub trait MyTrait3 { + fn method_trait_3(); +} + +impl MyTrait3 for MyType { + fn method_trait_3() {} +} + +// @hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_1' +// @hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_2' +// Avoid duplicating these docs. +// @!hasraw 'foo/type.MyType.html' 'method_trait_1' +// @!hasraw 'foo/type.MyType.html' 'method_trait_2' +// The one made directly on the type alias should be attached to the HTML instead. +// @!hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_3' +// @hasraw 'foo/type.MyType.html' 'method_trait_3' +pub type MyType = MyStruct<u16>; diff --git a/tests/rustdoc/issue-112515-impl-ty-alias.rs b/tests/rustdoc/type-alias/deeply-nested-112515.rs index 161188ee5..161188ee5 100644 --- a/tests/rustdoc/issue-112515-impl-ty-alias.rs +++ b/tests/rustdoc/type-alias/deeply-nested-112515.rs diff --git a/tests/rustdoc/issue-32077-type-alias-impls.rs b/tests/rustdoc/type-alias/deref-32077.rs index ac486c36a..186ebb1a6 100644 --- a/tests/rustdoc/issue-32077-type-alias-impls.rs +++ b/tests/rustdoc/type-alias/deref-32077.rs @@ -22,20 +22,21 @@ impl Bar for GenericStruct<u32> {} // 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="impl-GenericStruct%3Cu8%3E"]/h3' 'impl TypedefStruct' // @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()' -// @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl<T> GenericStruct<T>' -// @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)' -// @has - '//*[@id="impl-Foo-for-GenericStruct%3CT%3E"]/h3' 'impl<T> Foo for GenericStruct<T>' // This trait implementation doesn't match the type alias parameters so shouldn't appear in docs. // @!has - '//h3' 'impl Bar for GenericStruct<u32> {}' // Same goes for the `Deref` impl. // @!has - '//h2' 'Methods from Deref<Target = u32>' // @count - '//nav[@class="sidebar"]//a' 'on_alias' 1 -// @count - '//nav[@class="sidebar"]//a' 'on_gen' 1 -// @count - '//nav[@class="sidebar"]//a' 'Foo' 1 +// @!has - '//nav[@class="sidebar"]//a' 'on_gen' +// @!has - '//nav[@class="sidebar"]//a' 'Foo' // @!has - '//nav[@class="sidebar"]//a' 'Bar' // @!has - '//nav[@class="sidebar"]//a' 'on_u32' +// TypedefStruct inlined to GenericStruct +// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'TypedefStruct' +// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'method.on_gen' +// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'Foo' pub type TypedefStruct = GenericStruct<u8>; impl TypedefStruct { @@ -53,8 +54,11 @@ impl std::ops::Deref for GenericStruct<u32> { pub struct Wrap<T>(GenericStruct<T>); // @has 'foo/type.Alias.html' -// @has - '//h2' 'Methods from Deref<Target = u32>' -// @has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl<T> Deref for Wrap<T>' +// @!has - '//h2' 'Methods from Deref<Target = u32>' +// @!has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl<T> Deref for Wrap<T>' +// @hasraw 'type.impl/foo/struct.Wrap.js' 'impl-Deref-for-Wrap%3CT%3E' +// Deref Methods aren't gathered for type aliases, though the actual impl is. +// @!hasraw 'type.impl/foo/struct.Wrap.js' 'BITS' pub type Alias = Wrap<u32>; impl<T> std::ops::Deref for Wrap<T> { diff --git a/tests/rustdoc/type-alias/same-crate-115718.rs b/tests/rustdoc/type-alias/same-crate-115718.rs new file mode 100644 index 000000000..26e5db85c --- /dev/null +++ b/tests/rustdoc/type-alias/same-crate-115718.rs @@ -0,0 +1,34 @@ +// https://github.com/rust-lang/rust/issues/115718 +#![crate_name = "foo"] + +pub trait MyTrait1 { + fn method_trait_1(); +} + +pub trait MyTrait2 { + fn method_trait_2(); +} + +pub struct MyStruct<T>(T); + +impl MyStruct<u32> { + pub fn method_u32() {} +} + +impl MyStruct<u16> { + pub fn method_u16() {} +} + +impl MyTrait1 for MyStruct<u32> { + fn method_trait_1() {} +} + +impl MyTrait2 for MyStruct<u16> { + fn method_trait_2() {} +} + +// @hasraw 'type.impl/foo/struct.MyStruct.js' 'method_u16' +// @!hasraw 'type.impl/foo/struct.MyStruct.js' 'method_u32' +// @!hasraw 'type.impl/foo/struct.MyStruct.js' 'method_trait_1' +// @hasraw 'type.impl/foo/struct.MyStruct.js' 'method_trait_2' +pub type MyType = MyStruct<u16>; diff --git a/tests/rustdoc/version-separator-without-source.rs b/tests/rustdoc/version-separator-without-source.rs index 04ea46a7f..4a855b7bb 100644 --- a/tests/rustdoc/version-separator-without-source.rs +++ b/tests/rustdoc/version-separator-without-source.rs @@ -4,20 +4,20 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' -// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub fn foo() {} // @has foo/struct.Bar.html -// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · ' -// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · ' +// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · ' +// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · ' #[stable(feature = "bar", since = "1.0")] pub struct Bar; impl Bar { - // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0' - // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·' + // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0.0' + // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0.0 ·' #[stable(feature = "foobar", since = "2.0")] pub fn bar() {} } diff --git a/tests/rustdoc/where-clause-order.rs b/tests/rustdoc/where-clause-order.rs index b10f8f685..e3184b646 100644 --- a/tests/rustdoc/where-clause-order.rs +++ b/tests/rustdoc/where-clause-order.rs @@ -7,7 +7,7 @@ where } // @has 'foo/trait.SomeTrait.html' -// @has - "//*[@id='impl-SomeTrait%3C(A,+B,+C,+D,+E)%3E-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, " +// @has - "//*[@id='impl-SomeTrait-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, " impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E) where A: PartialOrd<A> + PartialEq<A>, @@ -17,3 +17,14 @@ where E: PartialOrd<E> + PartialEq<E> + ?Sized, { } + +// @has - "//*[@id='impl-SomeTrait%3C(A,+B,+C,+D)%3E-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, " +impl<A, B, C, D, E> SomeTrait<(A, B, C, D)> for (A, B, C, D, E) +where + A: PartialOrd<A> + PartialEq<A>, + B: PartialOrd<B> + PartialEq<B>, + C: PartialOrd<C> + PartialEq<C>, + D: PartialOrd<D> + PartialEq<D>, + E: PartialOrd<E> + PartialEq<E> + ?Sized, +{ +} diff --git a/tests/rustdoc/whitespace-after-where-clause.enum.html b/tests/rustdoc/whitespace-after-where-clause.enum.html index 20b60b68e..ff4971f33 100644 --- a/tests/rustdoc/whitespace-after-where-clause.enum.html +++ b/tests/rustdoc/whitespace-after-where-clause.enum.html @@ -1,5 +1,5 @@ <pre class="rust item-decl"><code>pub enum Cow<'a, B><span class="where fmt-newline">where - B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ + B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.enum2.html b/tests/rustdoc/whitespace-after-where-clause.enum2.html index 065ce757d..bfc50f8ad 100644 --- a/tests/rustdoc/whitespace-after-where-clause.enum2.html +++ b/tests/rustdoc/whitespace-after-where-clause.enum2.html @@ -1,4 +1,4 @@ -<pre class="rust item-decl"><code>pub enum Cow2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<pre class="rust item-decl"><code>pub enum Cow2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + 'a> { Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.rs b/tests/rustdoc/whitespace-after-where-clause.rs index b540c7c97..832d3728e 100644 --- a/tests/rustdoc/whitespace-after-where-clause.rs +++ b/tests/rustdoc/whitespace-after-where-clause.rs @@ -6,7 +6,8 @@ // @has 'foo/trait.ToOwned.html' // @snapshot trait - '//*[@class="rust item-decl"]' pub trait ToOwned<T> -where T: Clone +where + T: Clone, { type Owned; fn to_owned(&self) -> Self::Owned; @@ -26,7 +27,7 @@ pub trait ToOwned2<T: Clone> { // @snapshot enum - '//*[@class="rust item-decl"]' pub enum Cow<'a, B: ?Sized + 'a> where - B: ToOwned<Clone>, + B: ToOwned<()>, { Borrowed(&'a B), Whatever(u32), @@ -35,7 +36,7 @@ where // @has 'foo/enum.Cow2.html' // @snapshot enum2 - '//*[@class="rust item-decl"]' // There should be a whitespace before `{` in this case! -pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> { +pub enum Cow2<'a, B: ?Sized + ToOwned<()> + 'a> { Borrowed(&'a B), Whatever(u32), } @@ -44,7 +45,7 @@ pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> { // @snapshot struct - '//*[@class="rust item-decl"]' pub struct Struct<'a, B: ?Sized + 'a> where - B: ToOwned<Clone>, + B: ToOwned<()>, { pub a: &'a B, pub b: u32, @@ -53,7 +54,7 @@ where // @has 'foo/struct.Struct2.html' // @snapshot struct2 - '//*[@class="rust item-decl"]' // There should be a whitespace before `{` in this case! -pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> { +pub struct Struct2<'a, B: ?Sized + ToOwned<()> + 'a> { pub a: &'a B, pub b: u32, } @@ -62,7 +63,7 @@ pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> { // @snapshot union - '//*[@class="rust item-decl"]' pub union Union<'a, B: ?Sized + 'a> where - B: ToOwned<Clone>, + B: ToOwned<()>, { a: &'a B, b: u32, @@ -71,7 +72,7 @@ where // @has 'foo/union.Union2.html' // @snapshot union2 - '//*[@class="rust item-decl"]' // There should be a whitespace before `{` in this case! -pub union Union2<'a, B: ?Sized + ToOwned<Clone> + 'a> { +pub union Union2<'a, B: ?Sized + ToOwned<()> + 'a> { a: &'a B, b: u32, } diff --git a/tests/rustdoc/whitespace-after-where-clause.struct.html b/tests/rustdoc/whitespace-after-where-clause.struct.html index 948ddc499..ca6853586 100644 --- a/tests/rustdoc/whitespace-after-where-clause.struct.html +++ b/tests/rustdoc/whitespace-after-where-clause.struct.html @@ -1,5 +1,5 @@ <pre class="rust item-decl"><code>pub struct Struct<'a, B><span class="where fmt-newline">where - B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ + B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.struct2.html b/tests/rustdoc/whitespace-after-where-clause.struct2.html index c647e8d71..5aa8110c1 100644 --- a/tests/rustdoc/whitespace-after-where-clause.struct2.html +++ b/tests/rustdoc/whitespace-after-where-clause.struct2.html @@ -1,4 +1,4 @@ -<pre class="rust item-decl"><code>pub struct Struct2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<pre class="rust item-decl"><code>pub struct Struct2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + 'a> { pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.union.html b/tests/rustdoc/whitespace-after-where-clause.union.html index 38b6cb8b5..40b0c6712 100644 --- a/tests/rustdoc/whitespace-after-where-clause.union.html +++ b/tests/rustdoc/whitespace-after-where-clause.union.html @@ -1,4 +1,4 @@ <pre class="rust item-decl"><code>pub union Union<'a, B><span class="where fmt-newline">where - B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ + B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ /* private fields */ }</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.union2.html b/tests/rustdoc/whitespace-after-where-clause.union2.html index 66ad30c92..177a161b8 100644 --- a/tests/rustdoc/whitespace-after-where-clause.union2.html +++ b/tests/rustdoc/whitespace-after-where-clause.union2.html @@ -1,3 +1,3 @@ -<pre class="rust item-decl"><code>pub union Union2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<pre class="rust item-decl"><code>pub union Union2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>> + 'a> { /* private fields */ }</code></pre>
\ No newline at end of file |