2020-08-07 19:07:43 -05:00
|
|
|
//@ aux-build:elided-lifetime.rs
|
|
|
|
//
|
2020-08-06 18:48:24 -05:00
|
|
|
// rust-lang/rust#75225
|
|
|
|
//
|
|
|
|
// Since Rust 2018 we encourage writing out <'_> explicitly to make it clear
|
2022-08-17 21:13:37 -05:00
|
|
|
// that borrowing is occurring. Make sure rustdoc is following the same idiom.
|
2020-08-06 18:48:24 -05:00
|
|
|
|
2020-08-07 19:07:43 -05:00
|
|
|
#![crate_name = "foo"]
|
|
|
|
|
2020-08-06 18:48:24 -05:00
|
|
|
pub struct Ref<'a>(&'a u32);
|
|
|
|
type ARef<'a> = Ref<'a>;
|
|
|
|
|
|
|
|
// @has foo/fn.test1.html
|
2022-08-10 15:13:18 -05:00
|
|
|
// @matchesraw - "Ref</a><'_>"
|
2020-08-06 18:48:24 -05:00
|
|
|
pub fn test1(a: &u32) -> Ref {
|
|
|
|
Ref(a)
|
|
|
|
}
|
|
|
|
|
|
|
|
// @has foo/fn.test2.html
|
2022-08-10 15:13:18 -05:00
|
|
|
// @matchesraw - "Ref</a><'_>"
|
2020-08-06 18:48:24 -05:00
|
|
|
pub fn test2(a: &u32) -> Ref<'_> {
|
|
|
|
Ref(a)
|
|
|
|
}
|
|
|
|
|
|
|
|
// @has foo/fn.test3.html
|
2022-08-10 15:13:18 -05:00
|
|
|
// @matchesraw - "Ref</a><'_>"
|
2020-08-06 18:48:24 -05:00
|
|
|
pub fn test3(a: &u32) -> ARef {
|
|
|
|
Ref(a)
|
|
|
|
}
|
|
|
|
|
|
|
|
// @has foo/fn.test4.html
|
2022-08-10 15:13:18 -05:00
|
|
|
// @matchesraw - "Ref</a><'_>"
|
2020-08-06 18:48:24 -05:00
|
|
|
pub fn test4(a: &u32) -> ARef<'_> {
|
|
|
|
Ref(a)
|
|
|
|
}
|
2020-08-07 17:34:44 -05:00
|
|
|
|
2020-08-07 19:07:43 -05:00
|
|
|
// Ensure external paths in inlined docs also display elided lifetime
|
|
|
|
// @has foo/bar/fn.test5.html
|
2022-08-10 15:13:18 -05:00
|
|
|
// @matchesraw - "Ref</a><'_>"
|
2020-08-07 19:07:43 -05:00
|
|
|
// @has foo/bar/fn.test6.html
|
2022-08-10 15:13:18 -05:00
|
|
|
// @matchesraw - "Ref</a><'_>"
|
2020-08-07 19:07:43 -05:00
|
|
|
#[doc(inline)]
|
|
|
|
pub extern crate bar;
|