diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs index bba7b4c4834..b90e39f2b23 100644 --- a/src/comp/middle/tstate/states.rs +++ b/src/comp/middle/tstate/states.rs @@ -190,8 +190,8 @@ fn find_pre_post_state_call(fcx: fn_ctxt, pres: prestate, a: @expr, %u exprs vs. %u ops", vec::len(bs), vec::len(ops)]); } - ret find_pre_post_state_exprs(fcx, expr_poststate(fcx.ccx, a), id, ops, - bs, cf) || changed; + ret find_pre_post_state_exprs(fcx, pres, id, ops, + bs, cf) || changed; } fn find_pre_post_state_exprs(fcx: fn_ctxt, pres: prestate, id: node_id, diff --git a/src/test/run-pass/issue-1895.rs b/src/test/run-pass/issue-1895.rs new file mode 100644 index 00000000000..3be9fa65b83 --- /dev/null +++ b/src/test/run-pass/issue-1895.rs @@ -0,0 +1,7 @@ +fn main() { + let x = 1; + let y = fn@[move x]() -> int { + x + }(); +} +