about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-11-21 18:05:29 +0100
committerRalf Jung <post@ralfj.de>2020-12-20 15:15:28 +0100
commitf8d4883dbebf71348abe1134c6f26d48a36256b9 (patch)
treeaf16e9c838557e65cb19a3e859de93bf0d254562
parent54a3ed3114c5fcacfa9ec15e89935c105b4c00a9 (diff)
downloadrust-f8d4883dbebf71348abe1134c6f26d48a36256b9.tar.gz
rust-f8d4883dbebf71348abe1134c6f26d48a36256b9.zip
add test that repeating non-Copy constants works
-rw-r--r--src/test/ui/consts/rfc-2203-const-array-repeat-exprs/const-repeat.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/consts/rfc-2203-const-array-repeat-exprs/const-repeat.rs b/src/test/ui/consts/rfc-2203-const-array-repeat-exprs/const-repeat.rs
new file mode 100644
index 00000000000..11611a94918
--- /dev/null
+++ b/src/test/ui/consts/rfc-2203-const-array-repeat-exprs/const-repeat.rs
@@ -0,0 +1,13 @@
+// check-pass
+
+// Repeating a *constant* of non-Copy type (not just a constant expression) is already stable.
+
+const EMPTY: Vec<i32> = Vec::new();
+
+pub fn bar() -> [Vec<i32>; 2] {
+    [EMPTY; 2]
+}
+
+fn main() {
+    let x = bar();
+}