]>
Commit | Line | Data |
---|---|---|
1 | // aux-build:elided-lifetime.rs | |
2 | // | |
3 | // rust-lang/rust#75225 | |
4 | // | |
5 | // Since Rust 2018 we encourage writing out <'_> explicitly to make it clear | |
6 | // that borrowing is occuring. Make sure rustdoc is following the same idiom. | |
7 | ||
8 | #![crate_name = "foo"] | |
9 | ||
10 | pub struct Ref<'a>(&'a u32); | |
11 | type ARef<'a> = Ref<'a>; | |
12 | ||
13 | // @has foo/fn.test1.html | |
14 | // @matches - "Ref</a><'_>" | |
15 | pub fn test1(a: &u32) -> Ref { | |
16 | Ref(a) | |
17 | } | |
18 | ||
19 | // @has foo/fn.test2.html | |
20 | // @matches - "Ref</a><'_>" | |
21 | pub fn test2(a: &u32) -> Ref<'_> { | |
22 | Ref(a) | |
23 | } | |
24 | ||
25 | // @has foo/fn.test3.html | |
26 | // @matches - "Ref</a><'_>" | |
27 | pub fn test3(a: &u32) -> ARef { | |
28 | Ref(a) | |
29 | } | |
30 | ||
31 | // @has foo/fn.test4.html | |
32 | // @matches - "Ref</a><'_>" | |
33 | pub fn test4(a: &u32) -> ARef<'_> { | |
34 | Ref(a) | |
35 | } | |
36 | ||
37 | // Ensure external paths in inlined docs also display elided lifetime | |
38 | // @has foo/bar/fn.test5.html | |
39 | // @matches - "Ref</a><'_>" | |
40 | // @has foo/bar/fn.test6.html | |
41 | // @matches - "Ref</a><'_>" | |
42 | #[doc(inline)] | |
43 | pub extern crate bar; |