summaryrefslogtreecommitdiffstats
path: root/tests/ui/no-capture-arc.rs
blob: 3f0b075778bd9c8ef285476246bd39b9a24c30b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// error-pattern: borrow of moved value

use std::sync::Arc;
use std::thread;

fn main() {
    let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    let arc_v = Arc::new(v);

    thread::spawn(move|| {
        assert_eq!((*arc_v)[3], 4);
    });

    assert_eq!((*arc_v)[2], 3);

    println!("{:?}", *arc_v);
}