diff --git a/src/test/rustdoc/auxiliary/elided-lifetime.rs b/src/test/rustdoc/auxiliary/elided-lifetime.rs new file mode 100644 index 0000000000000..4f2c93379d88e --- /dev/null +++ b/src/test/rustdoc/auxiliary/elided-lifetime.rs @@ -0,0 +1,11 @@ +#![crate_name = "bar"] + +pub struct Ref<'a>(&'a u32); + +pub fn test5(a: &u32) -> Ref { + Ref(a) +} + +pub fn test6(a: &u32) -> Ref<'_> { + Ref(a) +} diff --git a/src/test/rustdoc/elided-lifetime.rs b/src/test/rustdoc/elided-lifetime.rs index 6ba58380ed593..5a32554f972b7 100644 --- a/src/test/rustdoc/elided-lifetime.rs +++ b/src/test/rustdoc/elided-lifetime.rs @@ -1,10 +1,12 @@ -#![crate_name = "foo"] - +// aux-build:elided-lifetime.rs +// // rust-lang/rust#75225 // // Since Rust 2018 we encourage writing out <'_> explicitly to make it clear // that borrowing is occuring. Make sure rustdoc is following the same idiom. +#![crate_name = "foo"] + pub struct Ref<'a>(&'a u32); type ARef<'a> = Ref<'a>; @@ -32,15 +34,10 @@ pub fn test4(a: &u32) -> ARef<'_> { Ref(a) } -// Ensure external paths also display elided lifetime -// @has foo/fn.test5.html -// @matches - "Iter<'_" -pub fn test5(a: &Option) -> std::option::Iter { - a.iter() -} - -// @has foo/fn.test6.html -// @matches - "Iter<'_" -pub fn test6(a: &Option) -> std::option::Iter<'_, u32> { - a.iter() -} +// Ensure external paths in inlined docs also display elided lifetime +// @has foo/bar/fn.test5.html +// @matches - "Ref<'_>" +// @has foo/bar/fn.test6.html +// @matches - "Ref<'_>" +#[doc(inline)] +pub extern crate bar;