Skip to content

Borrow-check considers argument borrows to live too long #7729

Closed
@bblum

Description

@bblum

Example program:

use std::util;
fn main() {
    let mut x = ();
    util::ignore((&mut x, util::ignore(&mut x)));
}

The error is "can't borrow x as mutable more than once at a time", even though a trivial rewrite of the program would show that the first borrow doesn't live until the second function call is made.

In case this looks too contrived, the actual code I was writing when I ran into this was:

sched.enqueue_task(blk(~Task::new_root(&mut sched.stack_pool, ||{})));

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions