Skip to content

librustc: Make sure region bounds on closures outlive calls to them. #17175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2014

Conversation

pcwalton
Copy link
Contributor

This can break code like:

fn call_rec(f: |uint| -> uint) -> uint {
    (|x| f(x))(call_rec(f))
}

Change this code to use a temporary instead of violating the borrow
rules:

fn call_rec(f: |uint| -> uint) -> uint {
    let tmp = call_rec(|x| f(x)); f(tmp)
}

Closes #17144.

[breaking-change]

r? @huonw

This can break code like:

    fn call_rec(f: |uint| -> uint) -> uint {
        (|x| f(x))(call_rec(f))
    }

Change this code to use a temporary instead of violating the borrow
rules:

    fn call_rec(f: |uint| -> uint) -> uint {
        let tmp = call_rec(|x| f(x)); f(tmp)
    }

Closes rust-lang#17144.

[breaking-change]
bors added a commit that referenced this pull request Sep 13, 2014
This can break code like:

    fn call_rec(f: |uint| -> uint) -> uint {
        (|x| f(x))(call_rec(f))
    }

Change this code to use a temporary instead of violating the borrow
rules:

    fn call_rec(f: |uint| -> uint) -> uint {
        let tmp = call_rec(|x| f(x)); f(tmp)
    }

Closes #17144.

[breaking-change]

r? @huonw
@bors bors closed this Sep 13, 2014
@bors bors merged commit a9b929d into rust-lang:master Sep 13, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request May 19, 2024
fix: Fix implicit ty args being lowered where they shouldn't

Fixes rust-lang/rust-analyzer#17173
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closure moved out inside own argument can be reborrowed after moving
3 participants