2012-08-14 20:53:54 -04:00
|
|
|
// error-pattern: reference is not valid outside of its lifetime
|
|
|
|
use std;
|
|
|
|
import std::arc;
|
|
|
|
fn main() {
|
|
|
|
let x = ~arc::rw_arc(1);
|
2012-08-20 12:23:37 -07:00
|
|
|
let mut y = None;
|
2012-08-14 20:53:54 -04:00
|
|
|
do x.write |one| {
|
2012-08-20 12:23:37 -07:00
|
|
|
y = Some(one);
|
2012-08-14 20:53:54 -04:00
|
|
|
}
|
|
|
|
*option::unwrap(y) = 2;
|
|
|
|
}
|