Skip to content

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

Closed

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.

Activity

  1. added a commit that references this issue on Nov 6, 2012
    87b8938
  2. added a commit that references this issue on Feb 12, 2014
  3. added a commit that references this issue on Jun 4, 2024
  4. added a commit that references this issue on Aug 21, 2026
  5. added a commit that references this issue on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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