1 // aux-build:elided-lifetime.rs
3 // rust-lang/rust#75225
5 // Since Rust 2018 we encourage writing out <'_> explicitly to make it clear
6 // that borrowing is occurring. Make sure rustdoc is following the same idiom.
10 pub struct Ref<'a>(&'a u32);
11 type ARef<'a> = Ref<'a>;
13 // @has foo/fn.test1.html
14 // @matchesraw - "Ref</a><'_>"
15 pub fn test1(a: &u32) -> Ref {
19 // @has foo/fn.test2.html
20 // @matchesraw - "Ref</a><'_>"
21 pub fn test2(a: &u32) -> Ref<'_> {
25 // @has foo/fn.test3.html
26 // @matchesraw - "Ref</a><'_>"
27 pub fn test3(a: &u32) -> ARef {
31 // @has foo/fn.test4.html
32 // @matchesraw - "Ref</a><'_>"
33 pub fn test4(a: &u32) -> ARef<'_> {
37 // Ensure external paths in inlined docs also display elided lifetime
38 // @has foo/bar/fn.test5.html
39 // @matchesraw - "Ref</a><'_>"
40 // @has foo/bar/fn.test6.html
41 // @matchesraw - "Ref</a><'_>"