about summary refs log tree commit diff
path: root/src/test/ui/const-generics/issue-61522-array-len-succ.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/issue-61522-array-len-succ.rs')
-rw-r--r--src/test/ui/const-generics/issue-61522-array-len-succ.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.rs b/src/test/ui/const-generics/issue-61522-array-len-succ.rs
new file mode 100644
index 00000000000..3b627a5e530
--- /dev/null
+++ b/src/test/ui/const-generics/issue-61522-array-len-succ.rs
@@ -0,0 +1,14 @@
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+
+pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
+//~^ ERROR constant expression depends on a generic parameter
+
+impl<const COUNT: usize> MyArray<COUNT> {
+    fn inner(&self) -> &[u8; COUNT + 1] {
+        //~^ ERROR constant expression depends on a generic parameter
+        &self.0
+    }
+}
+
+fn main() {}