We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cb4e99b commit e1ba559Copy full SHA for e1ba559
src/test/compile-fail/implicit-copy-1.rs
@@ -0,0 +1,21 @@
1
+// error-pattern: cannot copy pinned type r
2
+
3
+resource r(i: @mutable int) {
4
+ *i = *i + 1;
5
+}
6
7
+fn movearg(i: r) {
8
+ // Implicit copy to mutate reference i
9
+ let j <- i;
10
11
12
+fn main() {
13
+ let i = @mutable 0;
14
+ {
15
+ let j <- r(i);
16
+ movearg(j);
17
+ }
18
+ log_err *i;
19
+ // nooooooo. destructor ran twice
20
+ assert *i == 2;
21
src/test/compile-fail/implicit-copy-2.rs
+// error-pattern: cannot copy pinned type 'a
+fn movearg<T>(i: T) {
0 commit comments