summary refs log tree commit diff
path: root/src/test/compile-fail/pinned-deep-copy.rs
blob: 1a07b3f1de0e09a058ade143289db424ab92efc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// error-pattern: copying a noncopyable value

resource r(i: @mut int) {
    *i = *i + 1;
}

fn main() {
    let i = @mut 0;
    {
        // Can't do this copy
        let x = ~~~{y: r(i)};
        let z = x;
        log(debug, x);
    }
    log(error, *i);
}