about summary refs log tree commit diff
path: root/tests/ui/repeat-expr/repeat-to-run-dtor-twice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/repeat-expr/repeat-to-run-dtor-twice.rs')
-rw-r--r--tests/ui/repeat-expr/repeat-to-run-dtor-twice.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/repeat-expr/repeat-to-run-dtor-twice.rs b/tests/ui/repeat-expr/repeat-to-run-dtor-twice.rs
new file mode 100644
index 00000000000..0cd8eceefc5
--- /dev/null
+++ b/tests/ui/repeat-expr/repeat-to-run-dtor-twice.rs
@@ -0,0 +1,19 @@
+// Tests that one can't run a destructor twice with the repeated vector
+// literal syntax.
+
+struct Foo {
+    x: isize,
+
+}
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("Goodbye!");
+    }
+}
+
+fn main() {
+    let a = Foo { x: 3 };
+    let _ = [ a; 5 ];
+    //~^ ERROR the trait bound `Foo: Copy` is not satisfied [E0277]
+}