File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 1- // Issue #8380
1+ //! Check that atomic types from `std::sync::atomic` are not `Copy`
2+ //! and cannot be moved out of a shared reference.
3+ //!
4+ //! Regression test for <https://github.com/rust-lang/rust/issues/8380>.
25
3-
4- use std:: sync:: atomic:: * ;
56use std:: ptr;
7+ use std:: sync:: atomic:: * ;
68
79fn main ( ) {
810 let x = AtomicBool :: new ( false ) ;
Original file line number Diff line number Diff line change 11error[E0507]: cannot move out of a shared reference
2- --> $DIR/std-uncopyable-atomics .rs:9 :13
2+ --> $DIR/atomic-types-not-copyable .rs:10 :13
33 |
44LL | let x = *&x;
55 | ^^^ move occurs because value has type `std::sync::atomic::AtomicBool`, which does not implement the `Copy` trait
@@ -11,7 +11,7 @@ LL + let x = &x;
1111 |
1212
1313error[E0507]: cannot move out of a shared reference
14- --> $DIR/std-uncopyable-atomics .rs:11 :13
14+ --> $DIR/atomic-types-not-copyable .rs:12 :13
1515 |
1616LL | let x = *&x;
1717 | ^^^ move occurs because value has type `std::sync::atomic::AtomicIsize`, which does not implement the `Copy` trait
@@ -23,7 +23,7 @@ LL + let x = &x;
2323 |
2424
2525error[E0507]: cannot move out of a shared reference
26- --> $DIR/std-uncopyable-atomics .rs:13 :13
26+ --> $DIR/atomic-types-not-copyable .rs:14 :13
2727 |
2828LL | let x = *&x;
2929 | ^^^ move occurs because value has type `std::sync::atomic::AtomicUsize`, which does not implement the `Copy` trait
@@ -35,7 +35,7 @@ LL + let x = &x;
3535 |
3636
3737error[E0507]: cannot move out of a shared reference
38- --> $DIR/std-uncopyable-atomics .rs:15 :13
38+ --> $DIR/atomic-types-not-copyable .rs:16 :13
3939 |
4040LL | let x = *&x;
4141 | ^^^ move occurs because value has type `std::sync::atomic::AtomicPtr<usize>`, which does not implement the `Copy` trait
You can’t perform that action at this time.
0 commit comments