rustdoc: Render Sized? on traits and generics

Both `trait Foo for Sized?` and `<Sized? T>` are handled correctly.

Fix #18515
This commit is contained in:
Tom Jakubowski
2014-11-24 10:14:46 -08:00
parent de94f0affb
commit 59d13820c4
6 changed files with 43 additions and 10 deletions

View File

@@ -1670,7 +1670,13 @@ fn item_function(w: &mut fmt::Formatter, it: &clean::Item,
fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
t: &clean::Trait) -> fmt::Result {
let mut bounds = String::new();
if let Some(ref ty) = t.default_unbound {
bounds.push_str(format!(" for {}?", ty).as_slice());
}
if t.bounds.len() > 0 {
if bounds.len() > 0 {
bounds.push(' ');
}
bounds.push_str(": ");
for (i, p) in t.bounds.iter().enumerate() {
if i > 0 { bounds.push_str(" + "); }