about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-02-05 16:58:53 +0100
committervarkor <github@varkor.com>2019-02-07 15:02:17 +0100
commit8fd597900629b215e858eebcfb24ab542364cc0e (patch)
treea8853f1fc4234e0301521e2fad88759113e19d5f
parent3991ba76ee25785b84d3cb3f345780bd48783529 (diff)
downloadrust-8fd597900629b215e858eebcfb24ab542364cc0e.tar.gz
rust-8fd597900629b215e858eebcfb24ab542364cc0e.zip
Add const generics feature gate test
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_generics.rs6
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_generics.stderr25
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.rs b/src/test/ui/feature-gates/feature-gate-const_generics.rs
new file mode 100644
index 00000000000..a8a4ed57722
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-const_generics.rs
@@ -0,0 +1,6 @@
+fn foo<const X: ()>() {} //~ ERROR const generics are unstable
+//~^ const generics in any position are currently unsupported
+
+struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.stderr b/src/test/ui/feature-gates/feature-gate-const_generics.stderr
new file mode 100644
index 00000000000..905cc07b6a1
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-const_generics.stderr
@@ -0,0 +1,25 @@
+error[E0658]: const generics are unstable (see issue #44580)
+  --> $DIR/feature-gate-const_generics.rs:1:14
+   |
+LL | fn foo<const X: ()>() {} //~ ERROR const generics are unstable
+   |              ^
+   |
+   = help: add #![feature(const_generics)] to the crate attributes to enable
+
+error[E0658]: const generics are unstable (see issue #44580)
+  --> $DIR/feature-gate-const_generics.rs:4:18
+   |
+LL | struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable
+   |                  ^
+   |
+   = help: add #![feature(const_generics)] to the crate attributes to enable
+
+error: const generics in any position are currently unsupported
+  --> $DIR/feature-gate-const_generics.rs:1:14
+   |
+LL | fn foo<const X: ()>() {} //~ ERROR const generics are unstable
+   |              ^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.