rustdoc: Render for<'_> lifetimes in trait objects
This commit is contained in:
parent
e0162a8a56
commit
1f65f56461
6 changed files with 61 additions and 29 deletions
|
|
@ -1,12 +0,0 @@
|
|||
#![crate_name = "foo"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub struct Foo {
|
||||
pub some_func: for<'a> fn(val: &'a i32) -> i32,
|
||||
pub some_trait: dyn for<'a> Trait<'a>,
|
||||
}
|
||||
|
||||
// @has foo/struct.Foo.html '//span[@id="structfield.some_func"]' "some_func: for<'a> fn(val: &'a i32) -> i32"
|
||||
// @has foo/struct.Foo.html '//span[@id="structfield.some_trait"]' "some_trait: dyn Trait<'a>"
|
||||
|
||||
pub trait Trait<'a> {}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#![crate_name = "foo"]
|
||||
|
||||
trait A<'x> {}
|
||||
// @has foo/trait.Trait.html
|
||||
pub trait Trait<'x> {}
|
||||
|
||||
// @has foo/fn.test1.html
|
||||
// @has - '//pre' "pub fn test1<T>() where for<'a> &'a T: Iterator,"
|
||||
|
|
@ -11,10 +12,10 @@ where
|
|||
}
|
||||
|
||||
// @has foo/fn.test2.html
|
||||
// @has - '//pre' "pub fn test2<T>() where for<'a, 'b> &'a T: A<'b>,"
|
||||
// @has - '//pre' "pub fn test2<T>() where for<'a, 'b> &'a T: Trait<'b>,"
|
||||
pub fn test2<T>()
|
||||
where
|
||||
for<'a, 'b> &'a T: A<'b>,
|
||||
for<'a, 'b> &'a T: Trait<'b>,
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -29,13 +30,24 @@ where
|
|||
// @has foo/struct.Foo.html
|
||||
pub struct Foo<'a> {
|
||||
_x: &'a u8,
|
||||
pub some_trait: &'a dyn for<'b> Trait<'b>,
|
||||
pub some_func: for<'c> fn(val: &'c i32) -> i32,
|
||||
}
|
||||
|
||||
// @has - '//span[@id="structfield.some_func"]' "some_func: for<'c> fn(val: &'c i32) -> i32"
|
||||
// @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>"
|
||||
|
||||
impl<'a> Foo<'a> {
|
||||
// @has - '//code' "pub fn bar<T>() where T: A<'a>,"
|
||||
// @has - '//code' "pub fn bar<T>() where T: Trait<'a>,"
|
||||
pub fn bar<T>()
|
||||
where
|
||||
T: A<'a>,
|
||||
T: Trait<'a>,
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// @has foo/trait.B.html
|
||||
pub trait B<'x> {}
|
||||
|
||||
// @has - '//code[@class="in-band"]' "impl<'a> B<'a> for dyn for<'b> Trait<'b>"
|
||||
impl<'a> B<'a> for dyn for<'b> Trait<'b> {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue