2012-04-26 16:02:01 -07:00
|
|
|
// xfail-pretty -- comments are infaithfully preserved
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut x: option<int> = none;
|
2012-06-30 12:23:59 +01:00
|
|
|
alt x { //~ NOTE loan of mutable local variable granted here
|
2012-08-03 19:59:04 -07:00
|
|
|
none => {}
|
|
|
|
some(i) => {
|
2012-04-26 16:02:01 -07:00
|
|
|
// Not ok: i is an outstanding ptr into x.
|
2012-06-30 12:23:59 +01: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
|
|
|
}
|