Skip to content

Part of "Closures" section of book could be clearer #26268

Closed
@ghost

Description

https://doc.rust-lang.org/book/closures.html#closures-and-their-environment

Right before the "move closures" section, the book doesn't really make it clear that this code would not compile:

let nums = vec![1, 2, 3];

let takes_nums = || nums;

println!("{:?}", nums);

It shows part of the compile error, but it just looks like a non-error message from the compiler.

Consider appending "the error message" to "This gives us".

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