]> git.lizzy.rs Git - rust.git/commit
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)
commite7f5d48059aa14cc2808473564deadd72d1e818d
tree1c4617a4299b50a733a99d3d5c045470aad8f99d
parent121320d5236b255049ef178669b5a279389cd1e5
parentd088edc5310518f740df973b6f85d078684152f6
Auto merge of #54976 - davidtwco:issue-52663-special-case-closures, r=nikomatsakis

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