about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-03-19 20:51:13 -0400
committerGitHub <noreply@github.com>2017-03-19 20:51:13 -0400
commitd49f86901cf1128cdc00b7a1b276f6bf266bf937 (patch)
treeef03d7fdd32204abf7e236da22fb99f85fe7922e /src/test/rustdoc
parentde724ba9a6cb1aa07d4725c536d949735d0cf12b (diff)
parent5364acb41870eca5b7b41c7980851e6a524c4ca3 (diff)
downloadrust-d49f86901cf1128cdc00b7a1b276f6bf266bf937.tar.gz
rust-d49f86901cf1128cdc00b7a1b276f6bf266bf937.zip
Rollup merge of #40587 - GuillaumeGomez:rustdoc-const-display, r=frewsxcv
Fix invalid debug display for associated consts

Fixes #40568.

r? @rust-lang/docs

cc @SergioBenitez
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/const-doc.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/rustdoc/const-doc.rs b/src/test/rustdoc/const-doc.rs
new file mode 100644
index 00000000000..9f70fe43175
--- /dev/null
+++ b/src/test/rustdoc/const-doc.rs
@@ -0,0 +1,31 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(associated_consts)]
+
+use std::marker::PhantomData;
+
+pub struct Foo<'a> {
+    f: PhantomData<&'a u32>,
+}
+
+pub struct ContentType {
+    pub ttype: Foo<'static>,
+    pub subtype: Foo<'static>,
+    pub params: Option<Foo<'static>>,
+}
+
+impl ContentType {
+    // @has const_doc/struct.ContentType.html
+    // @has  - '//*[@class="docblock"]' 'Any: ContentType = ContentType{ttype: Foo{f: '
+    pub const Any: ContentType = ContentType { ttype: Foo { f: PhantomData, },
+                                               subtype: Foo { f: PhantomData, },
+                                               params: None, };
+}