Skip to content

unboxed closures with multiple captures behave strangely #16197

Closed
@Tobba

Description

@Tobba

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions