]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/elided-lifetime.rs
Update upstream source from tag 'upstream/1.60.0+dfsg1'
[rustc.git] / src / test / rustdoc / elided-lifetime.rs
CommitLineData
3dfed10e
XL
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
10pub struct Ref<'a>(&'a u32);
11type ARef<'a> = Ref<'a>;
12
13// @has foo/fn.test1.html
14// @matches - "Ref</a>&lt;'_&gt;"
15pub fn test1(a: &u32) -> Ref {
16 Ref(a)
17}
18
19// @has foo/fn.test2.html
20// @matches - "Ref</a>&lt;'_&gt;"
21pub fn test2(a: &u32) -> Ref<'_> {
22 Ref(a)
23}
24
25// @has foo/fn.test3.html
26// @matches - "Ref</a>&lt;'_&gt;"
27pub fn test3(a: &u32) -> ARef {
28 Ref(a)
29}
30
31// @has foo/fn.test4.html
32// @matches - "Ref</a>&lt;'_&gt;"
33pub 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>&lt;'_&gt;"
40// @has foo/bar/fn.test6.html
41// @matches - "Ref</a>&lt;'_&gt;"
42#[doc(inline)]
43pub extern crate bar;