diff options
Diffstat (limited to 'tests/rustdoc/private')
25 files changed, 538 insertions, 0 deletions
diff --git a/tests/rustdoc/private/doc-hidden-private-67851-both.rs b/tests/rustdoc/private/doc-hidden-private-67851-both.rs new file mode 100644 index 00000000000..2e2190d8755 --- /dev/null +++ b/tests/rustdoc/private/doc-hidden-private-67851-both.rs @@ -0,0 +1,10 @@ +//@ compile-flags: -Zunstable-options --document-private-items --document-hidden-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +//@ has foo/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; + +//@ has foo/struct.Private.html +struct Private; diff --git a/tests/rustdoc/private/doc-hidden-private-67851-hidden.rs b/tests/rustdoc/private/doc-hidden-private-67851-hidden.rs new file mode 100644 index 00000000000..a811a04a668 --- /dev/null +++ b/tests/rustdoc/private/doc-hidden-private-67851-hidden.rs @@ -0,0 +1,10 @@ +//@ compile-flags: -Zunstable-options --document-hidden-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +//@ has foo/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; + +//@ !has foo/struct.Private.html +struct Private; diff --git a/tests/rustdoc/private/doc-hidden-private-67851-neither.rs b/tests/rustdoc/private/doc-hidden-private-67851-neither.rs new file mode 100644 index 00000000000..1f70ceefe44 --- /dev/null +++ b/tests/rustdoc/private/doc-hidden-private-67851-neither.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +//@ !has foo/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; + +//@ !has foo/struct.Private.html +struct Private; diff --git a/tests/rustdoc/private/doc-hidden-private-67851-private.rs b/tests/rustdoc/private/doc-hidden-private-67851-private.rs new file mode 100644 index 00000000000..f6f546ad5ea --- /dev/null +++ b/tests/rustdoc/private/doc-hidden-private-67851-private.rs @@ -0,0 +1,10 @@ +//@ compile-flags: --document-private-items +// https://github.com/rust-lang/rust/issues/67851 +#![crate_name="foo"] + +//@ !has foo/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; + +//@ has foo/struct.Private.html +struct Private; diff --git a/tests/rustdoc/private/empty-impl-block-private-with-doc.rs b/tests/rustdoc/private/empty-impl-block-private-with-doc.rs new file mode 100644 index 00000000000..5dc7e1aed7a --- /dev/null +++ b/tests/rustdoc/private/empty-impl-block-private-with-doc.rs @@ -0,0 +1,44 @@ +//@ compile-flags: --document-private-items + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] +#![crate_name = "foo"] + +//@ has 'foo/struct.Foo.html' +pub struct Foo; + +// There are 3 impl blocks with public item and one that should not be displayed +// by default because it only contains private items (but not in this case because +// we used `--document-private-items`). +//@ count - '//*[@class="impl"]' 'impl Foo' 4 + +// Impl block only containing private items should not be displayed unless the +// `--document-private-items` flag is used. +/// Private +impl Foo { + const BAR: u32 = 0; + type FOO = i32; + fn hello() {} +} + +// But if any element of the impl block is public, it should be displayed. +/// Not private +impl Foo { + pub const BAR: u32 = 0; + type FOO = i32; + fn hello() {} +} + +/// Not private +impl Foo { + const BAR: u32 = 0; + pub type FOO = i32; + fn hello() {} +} + +/// Not private +impl Foo { + const BAR: u32 = 0; + type FOO = i32; + pub fn hello() {} +} diff --git a/tests/rustdoc/private/empty-impl-block-private.rs b/tests/rustdoc/private/empty-impl-block-private.rs new file mode 100644 index 00000000000..2ee65d1a969 --- /dev/null +++ b/tests/rustdoc/private/empty-impl-block-private.rs @@ -0,0 +1,40 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] +#![crate_name = "foo"] + +//@ has 'foo/struct.Foo.html' +pub struct Foo; + +// There are 3 impl blocks with public item and one that should not be displayed +// because it only contains private items. +//@ count - '//*[@class="impl"]' 'impl Foo' 3 + +// Impl block only containing private items should not be displayed. +/// Private +impl Foo { + const BAR: u32 = 0; + type FOO = i32; + fn hello() {} +} + +// But if any element of the impl block is public, it should be displayed. +/// Not private +impl Foo { + pub const BAR: u32 = 0; + type FOO = i32; + fn hello() {} +} + +/// Not private +impl Foo { + const BAR: u32 = 0; + pub type FOO = i32; + fn hello() {} +} + +/// Not private +impl Foo { + const BAR: u32 = 0; + type FOO = i32; + pub fn hello() {} +} diff --git a/tests/rustdoc/private/empty-mod-private.rs b/tests/rustdoc/private/empty-mod-private.rs new file mode 100644 index 00000000000..5a8638cd5f5 --- /dev/null +++ b/tests/rustdoc/private/empty-mod-private.rs @@ -0,0 +1,19 @@ +//@ compile-flags: --document-private-items + +//@ has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo' +//@ hasraw 'empty_mod_private/sidebar-items.js' 'foo' +//@ matches 'empty_mod_private/foo/index.html' '//h1' 'Module foo' +//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private' +mod foo {} + +//@ has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar' +//@ hasraw 'empty_mod_private/sidebar-items.js' 'bar' +//@ matches 'empty_mod_private/bar/index.html' '//h1' 'Module bar' +//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private' +mod bar { + //@ has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz' + //@ hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz' + //@ matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module baz' + //@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::bar' + mod baz {} +} diff --git a/tests/rustdoc/private/enum-variant-private-46767.rs b/tests/rustdoc/private/enum-variant-private-46767.rs new file mode 100644 index 00000000000..cc93684e723 --- /dev/null +++ b/tests/rustdoc/private/enum-variant-private-46767.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/46767 +#![crate_name = "foo"] + +mod private { + pub enum Enum{Variant} +} +pub use self::private::Enum::*; + +//@ !has-dir foo/private +//@ !has foo/index.html '//a/@href' 'private/index.html' diff --git a/tests/rustdoc/private/files-creation-private.rs b/tests/rustdoc/private/files-creation-private.rs new file mode 100644 index 00000000000..54579380f0b --- /dev/null +++ b/tests/rustdoc/private/files-creation-private.rs @@ -0,0 +1,22 @@ +#![crate_name="foo"] + +//@ files "foo" \ +// '["index.html", "all.html", "sidebar-items.js", "foo", "bar", "private", "struct.Bar.html"]' +//@ files "foo/bar" '["index.html", "sidebar-items.js"]' + +//@ !has "foo/priv/index.html" +//@ !has "foo/priv/struct.Foo.html" +mod private { + pub struct Foo; +} + +//@ has "foo/struct.Bar.html" +pub use crate::private::Foo as Bar; + +//@ !has "foo/foo/index.html" +mod foo { + pub mod subfoo {} +} + +//@ has "foo/bar/index.html" +pub use crate::foo::subfoo as bar; diff --git a/tests/rustdoc/private/hidden-private.rs b/tests/rustdoc/private/hidden-private.rs new file mode 100644 index 00000000000..658e093cc23 --- /dev/null +++ b/tests/rustdoc/private/hidden-private.rs @@ -0,0 +1,50 @@ +// This is a regression test for <https://github.com/rust-lang/rust/issues/106373>. +// It ensures that the items in the `doc(hidden)` const block don't show up in the +// generated docs. + +//@ compile-flags: --document-private-items + +#![crate_name = "foo"] + +//@ has 'foo/index.html' +//@ count - '//*[@class="item-table"]//a[@class="struct"]' 2 +//@ count - '//*[@class="item-table"]//a[@class="trait"]' 1 +//@ count - '//*[@class="item-table"]//a[@class="macro"]' 0 +#[doc(hidden)] +const _: () = { + macro_rules! stry { + () => {}; + } + + struct ShouldBeHidden; + + //@ has 'foo/struct.Foo.html' + //@ !has - '//*[@class="code-header"]' 'impl Bar for Foo' + #[doc(hidden)] + impl Bar for Foo { + fn bar(&self) { + struct SHouldAlsoBeHidden; + } + } + + //@ has 'foo/struct.Private.html' + //@ has - '//*[@id="impl-Bar-for-Private"]/*[@class="code-header"]' 'impl Bar for Private' + //@ has - '//*[@id="method.bar"]/*[@class="code-header"]' 'fn bar(&self)' + impl Bar for Private { + fn bar(&self) {} + } + + //@ has - '//*[@id="impl-Private"]/*[@class="code-header"]' 'impl Private' + //@ has - '//*[@id="method.tralala"]/*[@class="code-header"]' 'fn tralala()' + impl Private { + fn tralala() {} + } +}; + + +struct Private; +pub struct Foo; + +pub trait Bar { + fn bar(&self); +} diff --git a/tests/rustdoc/private/inline-private-with-intermediate-doc-hidden.rs b/tests/rustdoc/private/inline-private-with-intermediate-doc-hidden.rs new file mode 100644 index 00000000000..d27ecbad169 --- /dev/null +++ b/tests/rustdoc/private/inline-private-with-intermediate-doc-hidden.rs @@ -0,0 +1,23 @@ +// This test ensures that if a private item is re-exported with an intermediate +// `#[doc(hidden)]` re-export, it'll still be inlined (and not include any attribute +// from the doc hidden re-export. + +#![crate_name = "foo"] + +//@ has 'foo/index.html' +// There should only be one struct displayed. +//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 1 +//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs' +//@ has - '//*[@id="main-content"]//a[@href="struct.Reexport.html"]' 'Reexport' +//@ has - '//*[@id="main-content"]//dd' 'Visible. Original.' + +mod private { + /// Original. + pub struct Bar3; +} + +/// Hidden. +#[doc(hidden)] +pub use crate::private::Bar3; +/// Visible. +pub use self::Bar3 as Reexport; diff --git a/tests/rustdoc/private/inner-private-110422.rs b/tests/rustdoc/private/inner-private-110422.rs new file mode 100644 index 00000000000..31e28676879 --- /dev/null +++ b/tests/rustdoc/private/inner-private-110422.rs @@ -0,0 +1,64 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/110422>. +// This test ensures that inner items (except for implementations and macros) +// don't appear in documentation. + +//@ compile-flags: --document-private-items + +#![crate_name = "foo"] + +//@ has 'foo/index.html' +// Checking there is no "trait" entry. +//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 4 +//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs' +//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Constants' +//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Functions' +//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Macros' + +//@ has - '//a[@href="fn.foo.html"]' 'foo' +fn foo() { + fn bar() {} + + //@ has - '//a[@class="macro"]' 'visible_macro' + //@ !has - '//a[@class="macro"]' 'non_visible_macro' + //@ has 'foo/macro.visible_macro.html' + //@ !has 'foo/macro.non_visible_macro.html' + #[macro_export] + macro_rules! visible_macro { + () => {} + } + + macro_rules! non_visible_macro { + () => {} + } +} + +//@ has 'foo/index.html' +//@ has - '//a[@href="struct.Bar.html"]' 'Bar' +struct Bar; + +const BAR: i32 = { + //@ !has - '//a[@href="fn.yo.html"]' 'yo' + //@ !has 'foo/fn.yo.html' + fn yo() {} + + //@ !has 'foo/index.html' '//a[@href="trait.Foo.html"]' 'Foo' + //@ !has 'foo/trait.Foo.html' + trait Foo { + fn babar() {} + } + impl Foo for Bar {} + + //@ has 'foo/struct.Bar.html' + //@ has - '//*[@id="method.foo"]/*[@class="code-header"]' 'pub(crate) fn foo()' + //@ count - '//*[@id="main-content"]/*[@class="section-header"]' 3 + // We now check that the `Foo` trait is not documented nor visible on `Bar` page. + //@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Implementations' + //@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Auto Trait Implementations' + //@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Blanket Implementations' + //@ !has - '//*[@href="trait.Foo.html#method.babar"]/*[@class="code-header"]' 'fn babar()' + impl Bar { + fn foo() {} + } + + 1 +}; diff --git a/tests/rustdoc/private/macro-document-private-duplicate.rs b/tests/rustdoc/private/macro-document-private-duplicate.rs new file mode 100644 index 00000000000..35cdc60dfdc --- /dev/null +++ b/tests/rustdoc/private/macro-document-private-duplicate.rs @@ -0,0 +1,25 @@ +//@ ignore-test (fails spuriously, see issue #89228) + +// FIXME: If two macros in the same module have the same name +// (yes, that's a thing), rustdoc lists both of them on the index page, +// but only documents the first one on the page for the macro. +// Fortunately, this can only happen in document private items mode, +// but it still isn't ideal behavior. +// +// See https://github.com/rust-lang/rust/pull/88019#discussion_r693920453 +// +//@ compile-flags: --document-private-items + +//@ hasraw macro_document_private_duplicate/index.html 'Doc 1.' +//@ hasraw macro_document_private_duplicate/macro.a_macro.html 'Doc 1.' +/// Doc 1. +macro_rules! a_macro { + () => () +} + +//@ hasraw macro_document_private_duplicate/index.html 'Doc 2.' +//@ !hasraw macro_document_private_duplicate/macro.a_macro.html 'Doc 2.' +/// Doc 2. +macro_rules! a_macro { + () => () +} diff --git a/tests/rustdoc/private/macro-document-private.rs b/tests/rustdoc/private/macro-document-private.rs new file mode 100644 index 00000000000..224e31f8312 --- /dev/null +++ b/tests/rustdoc/private/macro-document-private.rs @@ -0,0 +1,19 @@ +// Checks that private macros are documented when `--document-private-items` +// is present. +// +// This is a regression test for issue #73754. +// +//@ compile-flags: --document-private-items + +#![feature(decl_macro)] + + +//@ has macro_document_private/macro.some_macro.html +macro some_macro { + (a: tt) => {} +} + +//@ has macro_document_private/macro.another_macro.html +macro_rules! another_macro { + (a: tt) => {} +} diff --git a/tests/rustdoc/private/macro-private-not-documented.rs b/tests/rustdoc/private/macro-private-not-documented.rs new file mode 100644 index 00000000000..bd97be5d366 --- /dev/null +++ b/tests/rustdoc/private/macro-private-not-documented.rs @@ -0,0 +1,19 @@ +// Checks that private macros aren't documented by default. They +// should be still be documented in `--document-private-items` mode, +// but that's tested in `macro-document-private.rs`. +// +// +// This is a regression text for issue #88453. +#![feature(decl_macro)] + +//@ !hasraw macro_private_not_documented/index.html 'a_macro' +//@ !has macro_private_not_documented/macro.a_macro.html +macro_rules! a_macro { + () => () +} + +//@ !hasraw macro_private_not_documented/index.html 'another_macro' +//@ !has macro_private_not_documented/macro.another_macro.html +macro another_macro { + () => () +} diff --git a/tests/rustdoc/private/missing-private-inlining-109258.rs b/tests/rustdoc/private/missing-private-inlining-109258.rs new file mode 100644 index 00000000000..7f010f160c4 --- /dev/null +++ b/tests/rustdoc/private/missing-private-inlining-109258.rs @@ -0,0 +1,27 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/109258>. + +#![crate_name = "foo"] + +//@ has 'foo/index.html' +// We should only have a "Re-exports" and a "Modules" headers. +//@ count - '//*[@id="main-content"]/h2[@class="section-header"]' 2 +//@ has - '//*[@id="main-content"]/h2[@class="section-header"]' 'Re-exports' +//@ has - '//*[@id="main-content"]/h2[@class="section-header"]' 'Modules' + +//@ has - '//*[@id="reexport.Foo"]' 'pub use crate::issue_109258::Foo;' +//@ has - '//*[@id="reexport.Foo"]//a[@href="issue_109258/struct.Foo.html"]' 'Foo' +//@ !has 'foo/struct.Foo.html' +pub use crate::issue_109258::Foo; + +//@ has 'foo/issue_109258/index.html' +// We should only have a "Structs" header. +//@ count - '//*[@id="main-content"]/h2[@class="section-header"]' 1 +//@ has - '//*[@id="main-content"]/h2[@class="section-header"]' 'Structs' +//@ has - '//*[@id="main-content"]//a[@href="struct.Foo.html"]' 'Foo' +//@ has 'foo/issue_109258/struct.Foo.html' +pub mod issue_109258 { + mod priv_mod { + pub struct Foo; + } + pub use self::priv_mod::Foo; +} diff --git a/tests/rustdoc/private/private-fields-tuple-struct.rs b/tests/rustdoc/private/private-fields-tuple-struct.rs new file mode 100644 index 00000000000..51141923cd8 --- /dev/null +++ b/tests/rustdoc/private/private-fields-tuple-struct.rs @@ -0,0 +1,15 @@ +// This test checks the diplay of "/* private fields */" sentence in tuple structs. +#![crate_name = "foo"] + +//@ has 'foo/struct.A.html' '//*[@class="rust item-decl"]/code' 'pub struct A(pub u8, _);' +pub struct A(pub u8, u8); +//@ has 'foo/struct.B.html' '//*[@class="rust item-decl"]/code' 'pub struct B(_, pub u8);' +pub struct B(u8, pub u8); +//@ has 'foo/struct.C.html' '//*[@class="rust item-decl"]/code' 'pub struct C(_, pub u8, _);' +pub struct C(u8, pub u8, u8); +//@ has 'foo/struct.D.html' '//*[@class="rust item-decl"]/code' 'pub struct D(pub u8, _, pub u8);' +pub struct D(pub u8, u8, pub u8); +//@ has 'foo/struct.E.html' '//*[@class="rust item-decl"]/code' 'pub struct E(/* private fields */);' +pub struct E(u8); +//@ has 'foo/struct.F.html' '//*[@class="rust item-decl"]/code' 'pub struct F(/* private fields */);' +pub struct F(u8, u8); diff --git a/tests/rustdoc/private/private-non-local-fields-2.rs b/tests/rustdoc/private/private-non-local-fields-2.rs new file mode 100644 index 00000000000..f2d3530c088 --- /dev/null +++ b/tests/rustdoc/private/private-non-local-fields-2.rs @@ -0,0 +1,11 @@ +//! This test makes sure that with never show the inner fields in the +//! aliased type view of type alias. + +//@ compile-flags: -Z unstable-options --document-private-items + +#![crate_name = "foo"] + +use std::collections::BTreeMap; + +//@ has 'foo/type.FooBar.html' '//*[@class="rust item-decl"]/code' 'struct FooBar { /* private fields */ }' +pub type FooBar = BTreeMap<u32, String>; diff --git a/tests/rustdoc/private/private-non-local-fields.rs b/tests/rustdoc/private/private-non-local-fields.rs new file mode 100644 index 00000000000..aa7f01a58c6 --- /dev/null +++ b/tests/rustdoc/private/private-non-local-fields.rs @@ -0,0 +1,9 @@ +//! This test makes sure that with never show the inner fields in the +//! aliased type view of type alias. + +#![crate_name = "foo"] + +use std::collections::BTreeMap; + +//@ has 'foo/type.FooBar.html' '//*[@class="rust item-decl"]/code' 'struct FooBar { /* private fields */ }' +pub type FooBar = BTreeMap<u32, String>; diff --git a/tests/rustdoc/private/private-type-alias.rs b/tests/rustdoc/private/private-type-alias.rs new file mode 100644 index 00000000000..5b5f52728a9 --- /dev/null +++ b/tests/rustdoc/private/private-type-alias.rs @@ -0,0 +1,31 @@ +type MyResultPriv<T> = Result<T, u16>; +pub type MyResultPub<T> = Result<T, u64>; + +//@ has private_type_alias/fn.get_result_priv.html '//pre' 'Result<u8, u16>' +pub fn get_result_priv() -> MyResultPriv<u8> { + panic!(); +} + +//@ has private_type_alias/fn.get_result_pub.html '//pre' 'MyResultPub<u32>' +pub fn get_result_pub() -> MyResultPub<u32> { + panic!(); +} + +pub type PubRecursive = u16; +type PrivRecursive3 = u8; +type PrivRecursive2 = PubRecursive; +type PrivRecursive1 = PrivRecursive3; + +// PrivRecursive1 is expanded twice and stops at u8 +// PrivRecursive2 is expanded once and stops at public type alias PubRecursive +//@ has private_type_alias/fn.get_result_recursive.html '//pre' '(u8, PubRecursive)' +pub fn get_result_recursive() -> (PrivRecursive1, PrivRecursive2) { + panic!(); +} + +type MyLifetimePriv<'a> = &'a isize; + +//@ has private_type_alias/fn.get_lifetime_priv.html '//pre' "&'static isize" +pub fn get_lifetime_priv() -> MyLifetimePriv<'static> { + panic!(); +} diff --git a/tests/rustdoc/private/private-type-cycle-110629.rs b/tests/rustdoc/private/private-type-cycle-110629.rs new file mode 100644 index 00000000000..e2376809697 --- /dev/null +++ b/tests/rustdoc/private/private-type-cycle-110629.rs @@ -0,0 +1,21 @@ +//@ compile-flags: --document-private-items + +// https://github.com/rust-lang/rust/issues/110629 +#![crate_name="foo"] +#![feature(type_alias_impl_trait)] + +type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + std::fmt::Debug; + +//@ has foo/type.Bar.html +//@ has - '//pre[@class="rust item-decl"]' \ +// "pub(crate) type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + Debug;" + +fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { + i +} + +fn main() { + let meh = 42; + let muh = 42; + assert_eq!(bar(&meh), bar(&muh)); +} diff --git a/tests/rustdoc/private/private-use-decl-macro-47038.rs b/tests/rustdoc/private/private-use-decl-macro-47038.rs new file mode 100644 index 00000000000..b72fca06d3b --- /dev/null +++ b/tests/rustdoc/private/private-use-decl-macro-47038.rs @@ -0,0 +1,12 @@ +#![feature(decl_macro)] + +#![crate_name = "foo"] + +// https://github.com/rust-lang/rust/issues/47038 + +use std::vec; + +//@ has 'foo/index.html' +//@ !has - '//*[@id="macros"]' 'Macros' +//@ !has - '//a/@href' 'macro.vec.html' +//@ !has 'foo/macro.vec.html' diff --git a/tests/rustdoc/private/private-use.rs b/tests/rustdoc/private/private-use.rs new file mode 100644 index 00000000000..689ed73140d --- /dev/null +++ b/tests/rustdoc/private/private-use.rs @@ -0,0 +1,13 @@ +// Regression test for <https://github.com/rust-lang/rust/pull/113374> to +// ensure it doesn't panic. + +mod generics { + pub enum WherePredicate { + EqPredicate, + } +} +pub mod visit { + use *; + pub fn visit_where_predicate<V>(_visitor: &mut V, _i: &WherePredicate) {} +} +pub use generics::*; diff --git a/tests/rustdoc/private/public-impl-mention-private-generic-46380-2.rs b/tests/rustdoc/private/public-impl-mention-private-generic-46380-2.rs new file mode 100644 index 00000000000..0445ae75e85 --- /dev/null +++ b/tests/rustdoc/private/public-impl-mention-private-generic-46380-2.rs @@ -0,0 +1,12 @@ +// https://github.com/rust-lang/rust/issues/46380 +#![crate_name="foo"] + +pub trait PublicTrait<T> {} + +//@ has foo/struct.PublicStruct.html +pub struct PublicStruct; + +//@ !has - '//*[@class="impl"]' 'impl PublicTrait<PrivateStruct> for PublicStruct' +impl PublicTrait<PrivateStruct> for PublicStruct {} + +struct PrivateStruct; diff --git a/tests/rustdoc/private/traits-in-bodies-private.rs b/tests/rustdoc/private/traits-in-bodies-private.rs new file mode 100644 index 00000000000..a3455b3255b --- /dev/null +++ b/tests/rustdoc/private/traits-in-bodies-private.rs @@ -0,0 +1,13 @@ +// when implementing the fix for traits-in-bodies, there was an ICE when documenting private items +// and a trait was defined in non-module scope + +//@ compile-flags:--document-private-items + +//@ has traits_in_bodies_private/struct.SomeStruct.html +//@ !has - '//code' 'impl HiddenTrait for SomeStruct' +pub struct SomeStruct; + +fn __implementation_details() { + trait HiddenTrait {} + impl HiddenTrait for SomeStruct {} +} |
