]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #54976 - davidtwco:issue-52663-special-case-closures, r=nikomatsakis
authorbors <bors@rust-lang.org>
Thu, 18 Oct 2018 18:14:52 +0000 (18:14 +0000)
committerbors <bors@rust-lang.org>
Thu, 18 Oct 2018 18:14:52 +0000 (18:14 +0000)
NLL lacks various special case handling of closures

Part of #52663.

Firstly, this PR extends existing handling of closures to also support generators.

Second, this PR adds the note found in the AST when a closure is invoked twice and captures a variable by-value:

```text
note: closure cannot be invoked more than once because it moves the variable `dict` out of its environment
  --> $DIR/issue-42065.rs:16:29
   |
LL |         for (key, value) in dict {
   |                             ^^^^
```

r? @nikomatsakis
cc @pnkfelix


Trivial merge