Closed
Description
fn make_adder(x: int) -> @fn(int) -> int { |y| x + y }
The above function gives a compile error:
mismatched types: expected @fn(int) -> int
but found &fn(int) -> int
(expected @ closure, found & closure)
If I change the expression syntax into an explicit return:
fn make_adder(x: int) -> @fn(int) -> int { return |y| x + y; }
the code compiler (and runs) without error.