mozilla/rust — Issue #1895: Unsatisfied precondition moving into a closure that is immediately called
Author: brson
Created: 2012-02-23 22:54:29+00:00
State: open
Labels: A-typestate, I-wrong

```
fn main() {
let x = 1;
let y = fn@[move x]() -> int {
x
}();
}
```

```
../src/test/run-pass/test.rs:6:14: 8:7 error: Unsatisfied precondition constraint (for example, init(x id=1 - arising from ../src/test/run-pass/test.rs:5:8: 5:13)) for expression:
fn@[move x]() -> int { x }()
Precondition:
init(x id=1 - arising from ../src/test/run-pass/test.rs:5:8: 5:13)
Prestate:
!init(y id=5 - arising from ../src/test/run-pass/test.rs:6:8: 8:7), !init(x id=1 - arising from ../src/test/run-pass/test.rs:5:8: 5:13), !init(main id=85 - arising from ../src/test/run-pass/test.rs:4:0: 1:0), !init(main! id=86 - arising from ../src/test/run-pass/test.rs:4:0: 1:0)
../src/test/run-pass/test.rs:6 let y = fn@[move x]() -> int {
../src/test/run-pass/test.rs:7 x
../src/test/run-pass/test.rs:8 }();
```