2012-04-26 16:02:01 -07:00
|
|
|
// xfail-pretty -- comments are infaithfully preserved
|
|
|
|
|
|
|
|
fn main() {
|
2012-08-20 12:23:37 -07:00
|
|
|
let mut x: Option<int> = None;
|
2012-08-06 12:34:08 -07:00
|
|
|
match x { //~ NOTE loan of mutable local variable granted here
|
2012-08-20 12:23:37 -07:00
|
|
|
None => {}
|
|
|
|
Some(ref i) => {
|
2012-04-26 16:02:01 -07:00
|
|
|
// Not ok: i is an outstanding ptr into x.
|
2012-08-20 12:23:37 -07:00
|
|
|
x = Some(*i+1); //~ ERROR assigning to mutable local variable prohibited due to outstanding loan
|
2012-04-26 16:02:01 -07:00
|
|
|
}
|
|
|
|
}
|
2012-05-23 20:53:49 -07:00
|
|
|
copy x; // just to prevent liveness warnings
|
2012-04-26 16:02:01 -07:00
|
|
|
}
|