Skip to content

Commit

Permalink
rustdoc: show default type parameters in generics
Browse files Browse the repository at this point in the history
fix #12291
  • Loading branch information
tomjakubowski committed Jun 21, 2014
1 parent b1646cb commit 94bace7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustdoc/clean/mod.rs
Expand Up @@ -40,7 +40,7 @@ use visit_ast;

/// A stable identifier to the particular version of JSON output.
/// Increment this when the `Crate` and related structures change.
pub static SCHEMA_VERSION: &'static str = "0.8.2";
pub static SCHEMA_VERSION: &'static str = "0.8.3";

mod inline;

Expand Down Expand Up @@ -449,6 +449,7 @@ pub struct TyParam {
pub name: String,
pub did: ast::DefId,
pub bounds: Vec<TyParamBound>,
pub default: Option<Type>
}

impl Clean<TyParam> for ast::TyParam {
Expand All @@ -457,6 +458,7 @@ impl Clean<TyParam> for ast::TyParam {
name: self.ident.clean(),
did: ast::DefId { krate: ast::LOCAL_CRATE, node: self.id },
bounds: self.bounds.clean().move_iter().collect(),
default: self.default.clean()
}
}
}
Expand All @@ -470,6 +472,7 @@ impl Clean<TyParam> for ty::TypeParameterDef {
name: self.ident.clean(),
did: self.def_id,
bounds: self.bounds.clean(),
default: self.default.clean()
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/librustdoc/html/format.rs
Expand Up @@ -82,6 +82,11 @@ impl fmt::Show for clean::Generics {
try!(write!(f, "{}", *bound));
}
}

match tp.default {
Some(ref ty) => { try!(write!(f, " = {}", ty)); },
None => {}
};
}
}
try!(f.write("&gt;".as_bytes()));
Expand Down

9 comments on commit 94bace7

@bors
Copy link
Contributor

@bors bors commented on 94bace7 Jun 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at tomjakubowski@94bace7

@bors
Copy link
Contributor

@bors bors commented on 94bace7 Jun 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging tomjakubowski/rust/rustdoc-default-typarams-12291 = 94bace7 into auto

@bors
Copy link
Contributor

@bors bors commented on 94bace7 Jun 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tomjakubowski/rust/rustdoc-default-typarams-12291 = 94bace7 merged ok, testing candidate = bd3961f2

@bors
Copy link
Contributor

@bors bors commented on 94bace7 Jun 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 94bace7 Jun 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at tomjakubowski@94bace7

@bors
Copy link
Contributor

@bors bors commented on 94bace7 Jun 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging tomjakubowski/rust/rustdoc-default-typarams-12291 = 94bace7 into auto

@bors
Copy link
Contributor

@bors bors commented on 94bace7 Jun 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tomjakubowski/rust/rustdoc-default-typarams-12291 = 94bace7 merged ok, testing candidate = 4362db0

@bors
Copy link
Contributor

@bors bors commented on 94bace7 Jun 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 4362db0

Please sign in to comment.