about summary refs log tree commit diff
path: root/tests/rustdoc/intra-doc/macro-caching-144965.rs
blob: e14b465aeea6d8e3e971c19a1c848d00099ce0a3 (plain)
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
// regression test for https://github.com/rust-lang/rust/issues/144965

#![crate_name = "foo"]
#![no_std]

#[doc(hidden)]
pub struct MyStruct;

macro_rules! my_macro {
    () => {
        pub fn my_function() {}

        /// Incorrect: [`my_function()`].
        #[doc(inline)]
        pub use $crate::MyStruct;

        /// Correct: [`my_function`].
        pub struct AnotherStruct;
    };
}


pub mod one {
    //@ has 'foo/one/index.html'
    //@ has - '//dl[@class="item-table"]/dd[1]/a[@href="fn.my_function.html"]/code' 'my_function'
    //@ has - '//dl[@class="item-table"]/dd[2]/a[@href="fn.my_function.html"]/code' 'my_function()'
    my_macro!();
}

pub mod two {
    //@ has 'foo/two/index.html'
    //@ has - '//dl[@class="item-table"]/dd[1]/a[@href="fn.my_function.html"]/code' 'my_function'
    //@ has - '//dl[@class="item-table"]/dd[2]/a[@href="fn.my_function.html"]/code' 'my_function()'
    my_macro!();
}