Skip to content

Commit cc249a0

Browse files
committed
std-uncopyable-atomics
1 parent bdada8b commit cc249a0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

tests/ui/sync/atomic-types-not-copyable.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
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::*;
56
use std::ptr;
7+
use std::sync::atomic::*;
68

79
fn main() {
810
let x = AtomicBool::new(false);

tests/ui/sync/atomic-types-not-copyable.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[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
|
44
LL | 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

1313
error[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
|
1616
LL | 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

2525
error[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
|
2828
LL | 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

3737
error[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
|
4040
LL | let x = *&x;
4141
| ^^^ move occurs because value has type `std::sync::atomic::AtomicPtr<usize>`, which does not implement the `Copy` trait

0 commit comments

Comments
 (0)