]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Add Associated Constants section
authorUlrik Sverdrup <root@localhost>
Fri, 8 May 2015 22:16:20 +0000 (00:16 +0200)
committerUlrik Sverdrup <root@localhost>
Sat, 9 May 2015 10:20:45 +0000 (12:20 +0200)
Section only visible if there are assoc. consts. present.

src/librustdoc/html/render.rs
src/test/rustdoc/assoc-consts.rs

index 4074a6594427dacb1150f3e3d3dcdaf5f1eadf35..55e16db596a39ee38a8d3358adc86e26a6d7fe32 100644 (file)
@@ -1862,6 +1862,17 @@ fn trait_item(w: &mut fmt::Formatter, m: &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, "
index cd8d7ec16dce40deac7cf6e0c582400e316e44dd..20d4c744414c6a3e5178e34375c5ef328af4d813 100644 (file)
@@ -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;
 }