Skip to content

Leak when binding a stack closure #2036

Closed
@brson

Description

@brson

This example from the language reference leaks

fn main() {
    fn add(x: int, y: int) -> int {
        ret x + y;
    }

    type single_param_fn = fn(int) -> int;

    let add4: single_param_fn = bind add(4, _);
    let add5: single_param_fn = bind add(_, 5);

    assert (add(4,5) == add4(5));
    assert (add(4,5) == add5(4));
}
Unreclaimed object found at 0x678b7a0: ((), (5))
Unreclaimed object found at 0x678b730: ((), (4))
rust: fatal, 'leaked memory in rust main loop (2 objects)' failed, ../src/rt/memory_region.cpp:158 2 objects

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions