Skip to content

Commit 9a5104d

Browse files
committed
Rollup merge of rust-lang#33656 - GuillaumeGomez:lifetime_bound, r=steveklabnik
Add lifetime's bounds in doc generation Fixes rust-lang#33653 ![screenshot from 2016-05-15 15 30 38](https://cloud.githubusercontent.com/assets/3050060/15274445/024dbd5c-1ab2-11e6-9387-274301a05627.png) r? @steveklabnik
2 parents 86df075 + 391ae7f commit 9a5104d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/librustdoc/clean/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,17 @@ impl Clean<Lifetime> for hir::Lifetime {
795795

796796
impl Clean<Lifetime> for hir::LifetimeDef {
797797
fn clean(&self, _: &DocContext) -> Lifetime {
798-
Lifetime(self.lifetime.name.to_string())
798+
if self.bounds.len() > 0 {
799+
let mut s = format!("{}: {}",
800+
self.lifetime.name.to_string(),
801+
self.bounds[0].name.to_string());
802+
for bound in self.bounds.iter().skip(1) {
803+
s.push_str(&format!(" + {}", bound.name.to_string()));
804+
}
805+
Lifetime(s)
806+
} else {
807+
Lifetime(self.lifetime.name.to_string())
808+
}
799809
}
800810
}
801811

0 commit comments

Comments
 (0)