@@ -19,6 +19,11 @@ error[E0507]: cannot move out of a mutable reference
1919LL | let a = unsafe { *mut_ref() };
2020 | ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
2121 |
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+ | ^^^^^^^^
2227help: consider removing the dereference here
2328 |
2429LL - let a = unsafe { *mut_ref() };
@@ -31,6 +36,11 @@ error[E0507]: cannot move out of a shared reference
3136LL | let b = unsafe { *imm_ref() };
3237 | ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
3338 |
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+ | ^^^^^^^^
3444help: consider removing the dereference here
3545 |
3646LL - let b = unsafe { *imm_ref() };
@@ -43,6 +53,11 @@ error[E0507]: cannot move out of a raw pointer
4353LL | let c = unsafe { *mut_ptr() };
4454 | ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
4555 |
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+ | ^^^^^^^^
4661help: consider removing the dereference here
4762 |
4863LL - let c = unsafe { *mut_ptr() };
@@ -55,6 +70,11 @@ error[E0507]: cannot move out of a raw pointer
5570LL | let d = unsafe { *const_ptr() };
5671 | ^^^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
5772 |
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+ | ^^^^^^^^
5878help: consider removing the dereference here
5979 |
6080LL - let d = unsafe { *const_ptr() };
0 commit comments