Skip to content

unboxed closures with multiple captures behave strangely #16197

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

Closed
Tobba opened this issue Aug 2, 2014 · 2 comments
Closed

unboxed closures with multiple captures behave strangely #16197

Tobba opened this issue Aug 2, 2014 · 2 comments

Comments

@Tobba
Copy link
Contributor

Tobba commented Aug 2, 2014

Seems like the captures are being read from a slightly offset location

#![feature(unboxed_closures)]

fn main() {
    let (a, b) = (1u32, 2u32);
    println!("{} {}", a, b)
    let mut closure = |&mut: c: u32| println!("{} {} {}", a, b, c);
    closure.call((3,));
}

Output:

1 2
2 32575 3

(the argument is necessary to bypass #16168 and not using overloaded calls to get past #16166)

@Tobba
Copy link
Contributor Author

Tobba commented Aug 3, 2014

cc @pcwalton @hounw

@pcwalton
Copy link
Contributor

Fixed now.

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

No branches or pull requests

2 participants