]> git.lizzy.rs Git - rust.git/commitdiff
Add test for const impl
authorvarkor <github@varkor.com>
Fri, 10 May 2019 23:08:40 +0000 (00:08 +0100)
committervarkor <github@varkor.com>
Fri, 10 May 2019 23:08:40 +0000 (00:08 +0100)
src/test/ui/const-generics/impl-const-generic-struct.rs [new file with mode: 0644]
src/test/ui/const-generics/impl-const-generic-struct.stderr [new file with mode: 0644]

diff --git a/src/test/ui/const-generics/impl-const-generic-struct.rs b/src/test/ui/const-generics/impl-const-generic-struct.rs
new file mode 100644 (file)
index 0000000..7a0c0f2
--- /dev/null
@@ -0,0 +1,16 @@
+// run-pass
+
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+
+struct S<const X: u32>;
+
+impl<const X: u32> S<{X}> {
+    fn x() -> u32 {
+        X
+    }
+}
+
+fn main() {
+    assert_eq!(S::<19>::x(), 19);
+}
diff --git a/src/test/ui/const-generics/impl-const-generic-struct.stderr b/src/test/ui/const-generics/impl-const-generic-struct.stderr
new file mode 100644 (file)
index 0000000..d443e06
--- /dev/null
@@ -0,0 +1,6 @@
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+  --> $DIR/impl-const-generic-struct.rs:3:12
+   |
+LL | #![feature(const_generics)]
+   |            ^^^^^^^^^^^^^^
+