b0ed151539
Fixes #1896 which was never truly fixed, just masked. The given tests would have failed had they used `~fn()` and not `@fn()`. They now result in compilation errors. Fixes #2978. Necessary first step for #2202, #2263.
13 lines
283 B
Rust
13 lines
283 B
Rust
type boxedFn = { theFn: fn () -> uint };
|
|
|
|
fn createClosure (closedUint: uint) -> boxedFn {
|
|
{ theFn: fn@ () -> uint { closedUint } } //~ ERROR mismatched types
|
|
}
|
|
|
|
fn main () {
|
|
let aFn: boxedFn = createClosure(10);
|
|
|
|
let myInt: uint = aFn.theFn();
|
|
|
|
assert myInt == 10;
|
|
} |