about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-05-12 16:53:39 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-05-18 15:44:19 +0200
commit2caeaf54a1d44b1fe95c3ecaee9daa4ac576fd76 (patch)
tree20d06a0ff8846ec9c85083d99a0b13eeb3ef4dcc /src/test/rustdoc
parent548add7f61bfcbe3bea3f5ccefb53c84da8fefe4 (diff)
downloadrust-2caeaf54a1d44b1fe95c3ecaee9daa4ac576fd76.tar.gz
rust-2caeaf54a1d44b1fe95c3ecaee9daa4ac576fd76.zip
Fix display of const generics in rustdoc
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/generic-const.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/rustdoc/generic-const.rs b/src/test/rustdoc/generic-const.rs
new file mode 100644
index 00000000000..d6794ac8f1d
--- /dev/null
+++ b/src/test/rustdoc/generic-const.rs
@@ -0,0 +1,30 @@
+#![feature(const_generics)]
+#![crate_name = "foo"]
+
+// ignore-tidy-linelength
+
+pub enum Order {
+    Sorted,
+    Unsorted,
+}
+
+// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
+// @has foo/struct.VSet.html '//h3[@id="impl-Send"]/code' 'impl<const ORDER: Order, T> Send for VSet<T, ORDER>'
+// @has foo/struct.VSet.html '//h3[@id="impl-Sync"]/code' 'impl<const ORDER: Order, T> Sync for VSet<T, ORDER>'
+pub struct VSet<T, const ORDER: Order> {
+    inner: Vec<T>,
+}
+
+// @has foo/struct.VSet.html '//h3[@id="impl"]/code' 'impl<T> VSet<T, { Order::Sorted }>'
+impl <T> VSet<T, {Order::Sorted}> {
+    pub fn new() -> Self {
+        Self { inner: Vec::new() }
+    }
+}
+
+// @has foo/struct.VSet.html '//h3[@id="impl-1"]/code' 'impl<T> VSet<T, { Order::Unsorted }>'
+impl <T> VSet<T, {Order::Unsorted}> {
+    pub fn new() -> Self {
+        Self { inner: Vec::new() }
+    }
+}