Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,8 @@ impl DocFolder for Cache {
// Index this method for searching later on
if let Some(ref s) = item.name {
let (parent, is_method) = match item.inner {
clean::AssociatedTypeItem(..) |
clean::AssociatedConstItem(..) |
clean::TyMethodItem(..) |
clean::StructFieldItem(..) |
clean::VariantItem(..) => {
Expand Down Expand Up @@ -1860,6 +1862,17 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
try!(write!(w, "</div>"));
}

if !consts.is_empty() {
try!(write!(w, "
<h2 id='associated-const'>Associated Constants</h2>
<div class='methods'>
"));
for t in &consts {
try!(trait_item(w, *t));
}
try!(write!(w, "</div>"));
}

// Output the documentation for each function individually
if !required.is_empty() {
try!(write!(w, "
Expand Down
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"macro",
"primitive",
"associatedtype",
"constant"];
"constant",
"associatedconstant"];

$('.js-only').removeClass('js-only');

Expand Down
1 change: 1 addition & 0 deletions src/test/rustdoc/assoc-consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
pub trait Foo {
// @has assoc_consts/trait.Foo.html '//*[@class="rust trait"]' \
// 'const FOO: usize;'
// @has - '//*[@id="associatedconstant.FOO"]' 'const FOO'
const FOO: usize;
}

Expand Down