about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorOliver Middleton <olliemail27@gmail.com>2017-05-31 18:02:35 +0100
committerOliver Middleton <olliemail27@gmail.com>2017-05-31 20:05:28 +0100
commit86ea93e83cc0d0dbe59067d0154c6e32e73f094a (patch)
tree16b33856a76dc922ffedd7015a2b566050199f49 /src/test/rustdoc
parentfd7b44b78e39c71e5049a210a0c84a8931835cc3 (diff)
downloadrust-86ea93e83cc0d0dbe59067d0154c6e32e73f094a.tar.gz
rust-86ea93e83cc0d0dbe59067d0154c6e32e73f094a.zip
rustdoc: Cleanup associated const value rendering
Rather than (ab)using Debug for outputting the type in plain text use the
alternate format parameter which already does exactly that. This fixes
type parameters for example which would output raw HTML.

Also cleans up adding parens around references to trait objects.
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/assoc-consts.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs
index d4119f5d351..04709407e58 100644
--- a/src/test/rustdoc/assoc-consts.rs
+++ b/src/test/rustdoc/assoc-consts.rs
@@ -26,3 +26,21 @@ impl Bar {
     // @has - '//*[@class="docblock"]' 'BAR: usize = 3'
     pub const BAR: usize = 3;
 }
+
+pub struct Baz<'a, U: 'a, T>(T, &'a [U]);
+
+impl Bar {
+    // @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAZ"]' \
+    //      "const BAZ: Baz<'static, u8, u32>"
+    // @has - '//*[@class="docblock"]' "BAZ: Baz<'static, u8, u32> = Baz(321, &[1, 2, 3])"
+    pub const BAZ: Baz<'static, u8, u32> = Baz(321, &[1, 2, 3]);
+}
+
+pub fn f(_: &(ToString + 'static)) {}
+
+impl Bar {
+    // @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.F"]' \
+    //      "const F: fn(_: &(ToString + 'static))"
+    // @has - '//*[@class="docblock"]' "F: fn(_: &(ToString + 'static)) = f"
+    pub const F: fn(_: &(ToString + 'static)) = f;
+}