2023-04-17 07:35:33 -05:00
|
|
|
// 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"]
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has 'foo/index.html'
|
2023-04-17 07:35:33 -05:00
|
|
|
// Checking there is no "trait" entry.
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ 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'
|
2023-04-17 07:35:33 -05:00
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has - '//a[@href="fn.foo.html"]' 'foo'
|
2023-04-17 07:35:33 -05:00
|
|
|
fn foo() {
|
|
|
|
fn bar() {}
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ 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'
|
2023-04-17 07:35:33 -05:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! visible_macro {
|
|
|
|
() => {}
|
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! non_visible_macro {
|
|
|
|
() => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has 'foo/index.html'
|
|
|
|
//@ has - '//a[@href="struct.Bar.html"]' 'Bar'
|
2023-04-17 07:35:33 -05:00
|
|
|
struct Bar;
|
|
|
|
|
|
|
|
const BAR: i32 = {
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ !has - '//a[@href="fn.yo.html"]' 'yo'
|
|
|
|
//@ !has 'foo/fn.yo.html'
|
2023-04-17 07:35:33 -05:00
|
|
|
fn yo() {}
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ !has 'foo/index.html' '//a[@href="trait.Foo.html"]' 'Foo'
|
|
|
|
//@ !has 'foo/trait.Foo.html'
|
2023-04-17 07:35:33 -05:00
|
|
|
trait Foo {
|
|
|
|
fn babar() {}
|
|
|
|
}
|
|
|
|
impl Foo for Bar {}
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has 'foo/struct.Bar.html'
|
|
|
|
//@ has - '//*[@id="method.foo"]/*[@class="code-header"]' 'pub(crate) fn foo()'
|
|
|
|
//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 3
|
2023-04-17 07:35:33 -05:00
|
|
|
// We now check that the `Foo` trait is not documented nor visible on `Bar` page.
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ 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()'
|
2023-04-17 07:35:33 -05:00
|
|
|
impl Bar {
|
|
|
|
fn foo() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
1
|
|
|
|
};
|