about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-06-01 00:09:21 -0400
committerGitHub <noreply@github.com>2017-06-01 00:09:21 -0400
commitae75dbfc230ec8c7b835e799a7bd611450906f9a (patch)
tree8675f4b81929e50c9f8edc5538ab013261308b53 /src/test
parentdbc9d71b179bfe7e25704c17a574b8f579d3f776 (diff)
parent86ea93e83cc0d0dbe59067d0154c6e32e73f094a (diff)
downloadrust-ae75dbfc230ec8c7b835e799a7bd611450906f9a.tar.gz
rust-ae75dbfc230ec8c7b835e799a7bd611450906f9a.zip
Rollup merge of #42286 - ollie27:rustdoc_assoc_const, r=GuillaumeGomez
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')
-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;
+}