blob: 565629b1c306df59cae114fcbe10da62c6e6a9b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// Test that attempt to move `&mut` pointer while pointee is borrowed
// yields an error.
//
// Example from src/middle/borrowck/doc.rs
use std::util::swap;
fn foo(t0: &mut int) {
let p: &int = &*t0; // Freezes `*t0`
let t1 = t0; //~ ERROR cannot move out of `t0`
*t1 = 22;
}
fn main() {
}
|