]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #17175 : pcwalton/rust/region-bounds-on-closures, r=huonw
authorbors <bors@rust-lang.org>
Sat, 13 Sep 2014 08:06:00 +0000 (08:06 +0000)
committerbors <bors@rust-lang.org>
Sat, 13 Sep 2014 08:06:00 +0000 (08:06 +0000)
This can break code like:

    fn call_rec(f: |uint| -> uint) -> uint {
        (|x| f(x))(call_rec(f))
    }

Change this code to use a temporary instead of violating the borrow
rules:

    fn call_rec(f: |uint| -> uint) -> uint {
        let tmp = call_rec(|x| f(x)); f(tmp)
    }

Closes #17144.

[breaking-change]

r? @huonw

1  2 
src/librustc/middle/typeck/check/regionck.rs