summaryrefslogtreecommitdiffstats
path: root/src/test/ui/static/static-items-cant-move.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/static/static-items-cant-move.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/static/static-items-cant-move.rs b/src/test/ui/static/static-items-cant-move.rs
new file mode 100644
index 000000000..3e7aaa0b0
--- /dev/null
+++ b/src/test/ui/static/static-items-cant-move.rs
@@ -0,0 +1,19 @@
+// Verifies that static items can't be moved
+
+struct B;
+
+struct Foo {
+ foo: isize,
+ b: B,
+}
+
+static BAR: Foo = Foo { foo: 5, b: B };
+
+
+fn test(f: Foo) {
+ let _f = Foo{foo: 4, ..f};
+}
+
+fn main() {
+ test(BAR); //~ ERROR cannot move out of static item
+}