Skip to content

Borrowck doesn't consider calls to fn~ to be borrows #2978

Closed
@nikomatsakis

Description

@nikomatsakis

This program should fail:

fn call(x: @{mut f: fn~()}) {
    x.f(); //~ ERROR foo
    //~^ NOTE bar
}

fn main() {}

the reason is that it would be possible for the closure to cause itself to be freed. well, of course it's not actually possible in this case but it'd require alias analysis to know that.

Metadata

Metadata

Assignees

Labels

A-lifetimesArea: Lifetimes / regions

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions