File: nested-items-issue-111415.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 (36 lines) | stat: -rw-r--r-- 1,289 bytes parent folder | download | duplicates (2)
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
// Regression test for <https://github.com/rust-lang/rust/issues/111415>.
// This test ensures that only impl blocks are documented in bodies.

#![crate_name = "foo"]

//@ has 'foo/index.html'
// Checking there are only three sections.
//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 3
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs'
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Functions'
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Traits'
// Checking that there are only three items.
//@ count - '//*[@id="main-content"]//*[@class="item-name"]' 3
//@ has - '//*[@id="main-content"]//a[@href="struct.Bar.html"]' 'Bar'
//@ has - '//*[@id="main-content"]//a[@href="fn.foo.html"]' 'foo'
//@ has - '//*[@id="main-content"]//a[@href="trait.Foo.html"]' 'Foo'

// Now checking that the `foo` method is visible in `Bar` page.
//@ has 'foo/struct.Bar.html'
//@ has - '//*[@id="method.foo"]/*[@class="code-header"]' 'pub fn foo()'
//@ has - '//*[@id="method.bar"]/*[@class="code-header"]' 'fn bar()'
pub struct Bar;

pub trait Foo {
    fn bar() {}
}

pub fn foo() {
    pub mod inaccessible {}
    pub fn inner() {}
    pub const BAR: u32 = 0;
    impl Bar {
        pub fn foo() {}
    }
    impl Foo for Bar {}
}