about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-05-18 14:07:44 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-05-18 14:07:44 +0530
commit7a759d7ab6bc072a5e1c206356baf9c8ad633e36 (patch)
treed88e170a8dc69b7bccdf9432b97a36185e58a0e4 /src
parent75e23e1b032d87300392a4f3835bde8d5d873823 (diff)
parent391ae7f37aee43000f0244e696fe178521fae2ce (diff)
downloadrust-7a759d7ab6bc072a5e1c206356baf9c8ad633e36.tar.gz
rust-7a759d7ab6bc072a5e1c206356baf9c8ad633e36.zip
Rollup merge of #33656 - GuillaumeGomez:lifetime_bound, r=steveklabnik
Add lifetime's bounds in doc generation

Fixes #33653

![screenshot from 2016-05-15 15 30 38](https://cloud.githubusercontent.com/assets/3050060/15274445/024dbd5c-1ab2-11e6-9387-274301a05627.png)

r? @steveklabnik
Diffstat (limited to 'src')
-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 ce83c4a258c..3fbcdaf650e 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())
+        }
     }
 }