about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorJustus K <justus.k@protonmail.com>2021-05-18 10:06:24 +0200
committerJustus K <justus.k@protonmail.com>2021-06-18 21:58:09 +0200
commit1f65f56461fa72df809fff43975a7e72f08fda44 (patch)
tree3467d490de695f02614249f972a3eba12651738a /src/test/rustdoc
parente0162a8a56d1c59e185e293f33c38d94a5a2d462 (diff)
downloadrust-1f65f56461fa72df809fff43975a7e72f08fda44.tar.gz
rust-1f65f56461fa72df809fff43975a7e72f08fda44.zip
rustdoc: Render `for<'_>` lifetimes in trait objects
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/for-lifetime.rs12
-rw-r--r--src/test/rustdoc/higher-ranked-trait-bounds.rs22
2 files changed, 17 insertions, 17 deletions
diff --git a/src/test/rustdoc/for-lifetime.rs b/src/test/rustdoc/for-lifetime.rs
deleted file mode 100644
index 34a7eae31c7..00000000000
--- a/src/test/rustdoc/for-lifetime.rs
+++ /dev/null
@@ -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> {}
diff --git a/src/test/rustdoc/higher-ranked-trait-bounds.rs b/src/test/rustdoc/higher-ranked-trait-bounds.rs
index b5c55df287b..492a743fbf2 100644
--- a/src/test/rustdoc/higher-ranked-trait-bounds.rs
+++ b/src/test/rustdoc/higher-ranked-trait-bounds.rs
@@ -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> {}