about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs12
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr16
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs
new file mode 100644
index 00000000000..b0e3b13cc1e
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs
@@ -0,0 +1,12 @@
+#![allow(incomplete_features)]
+#![feature(adt_const_params)]
+
+#[derive(PartialEq, Eq)]
+struct NotParam;
+
+fn check<T: std::marker::ConstParamTy>() {}
+
+fn main() {
+    check::<[NotParam; 0]>();
+    //~^ error: `NotParam` can't be used as a const parameter type
+}
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr
new file mode 100644
index 00000000000..ef55242df87
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr
@@ -0,0 +1,16 @@
+error[E0277]: `NotParam` can't be used as a const parameter type
+  --> $DIR/const_param_ty_bad_empty_array.rs:10:13
+   |
+LL |     check::<[NotParam; 0]>();
+   |             ^^^^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `NotParam`
+   |
+   = note: required for `[NotParam; 0]` to implement `ConstParamTy`
+note: required by a bound in `check`
+  --> $DIR/const_param_ty_bad_empty_array.rs:7:13
+   |
+LL | fn check<T: std::marker::ConstParamTy>() {}
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.