about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2016-05-15 15:29:44 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2016-05-15 15:29:44 +0200
commit391ae7f37aee43000f0244e696fe178521fae2ce (patch)
tree2f46b9729e68a786dd25778788c4246a74a80f3a
parent1a26d2364f9da1667ca0098d3cc4a213d131f481 (diff)
downloadrust-391ae7f37aee43000f0244e696fe178521fae2ce.tar.gz
rust-391ae7f37aee43000f0244e696fe178521fae2ce.zip
Add lifetime's bounds in doc generation
-rw-r--r--src/librustdoc/clean/mod.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 7305b0f1fb8..b167c47c265 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -795,7 +795,17 @@ impl Clean<Lifetime> for hir::Lifetime {
 
 impl Clean<Lifetime> for hir::LifetimeDef {
     fn clean(&self, _: &DocContext) -> Lifetime {
-        Lifetime(self.lifetime.name.to_string())
+        if self.bounds.len() > 0 {
+            let mut s = format!("{}: {}",
+                                self.lifetime.name.to_string(),
+                                self.bounds[0].name.to_string());
+            for bound in self.bounds.iter().skip(1) {
+                s.push_str(&format!(" + {}", bound.name.to_string()));
+            }
+            Lifetime(s)
+        } else {
+            Lifetime(self.lifetime.name.to_string())
+        }
     }
 }