Skip to content

Commit

Permalink
Rollup merge of rust-lang#33656 - GuillaumeGomez:lifetime_bound, r=st…
Browse files Browse the repository at this point in the history
…eveklabnik

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
  • Loading branch information
eddyb committed May 17, 2016
2 parents 86df075 + 391ae7f commit 9a5104d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
}

Expand Down

0 comments on commit 9a5104d

Please sign in to comment.