Add cfail test arc-rw-state-shouldnt-escape

This commit is contained in:
Ben Blum 2012-08-14 20:53:54 -04:00
parent fa8fc4b2b5
commit f6f9333d5c

View file

@ -0,0 +1,11 @@
// error-pattern: reference is not valid outside of its lifetime
use std;
import std::arc;
fn main() {
let x = ~arc::rw_arc(1);
let mut y = none;
do x.write |one| {
y = some(one);
}
*option::unwrap(y) = 2;
}