File: inner-private-110422.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (64 lines) | stat: -rw-r--r-- 2,154 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
};