@@ -19,6 +19,11 @@ error[E0507]: cannot move out of a mutable reference
19
19
LL | let a = unsafe { *mut_ref() };
20
20
| ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
21
21
|
22
+ note: if `T` implemented `Clone`, you could clone the value
23
+ --> $DIR/issue-20801.rs:3:1
24
+ |
25
+ LL | struct T(u8);
26
+ | ^^^^^^^^
22
27
help: consider removing the dereference here
23
28
|
24
29
LL - let a = unsafe { *mut_ref() };
@@ -31,6 +36,11 @@ error[E0507]: cannot move out of a shared reference
31
36
LL | let b = unsafe { *imm_ref() };
32
37
| ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
33
38
|
39
+ note: if `T` implemented `Clone`, you could clone the value
40
+ --> $DIR/issue-20801.rs:3:1
41
+ |
42
+ LL | struct T(u8);
43
+ | ^^^^^^^^
34
44
help: consider removing the dereference here
35
45
|
36
46
LL - let b = unsafe { *imm_ref() };
@@ -43,6 +53,11 @@ error[E0507]: cannot move out of a raw pointer
43
53
LL | let c = unsafe { *mut_ptr() };
44
54
| ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
45
55
|
56
+ note: if `T` implemented `Clone`, you could clone the value
57
+ --> $DIR/issue-20801.rs:3:1
58
+ |
59
+ LL | struct T(u8);
60
+ | ^^^^^^^^
46
61
help: consider removing the dereference here
47
62
|
48
63
LL - let c = unsafe { *mut_ptr() };
@@ -55,6 +70,11 @@ error[E0507]: cannot move out of a raw pointer
55
70
LL | let d = unsafe { *const_ptr() };
56
71
| ^^^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
57
72
|
73
+ note: if `T` implemented `Clone`, you could clone the value
74
+ --> $DIR/issue-20801.rs:3:1
75
+ |
76
+ LL | struct T(u8);
77
+ | ^^^^^^^^
58
78
help: consider removing the dereference here
59
79
|
60
80
LL - let d = unsafe { *const_ptr() };
0 commit comments