]> git.lizzy.rs Git - rust.git/commit
Auto merge of #42443 - tommyip:better_closure_msg, r=nikomatsakis
authorbors <bors@rust-lang.org>
Thu, 8 Jun 2017 08:37:48 +0000 (08:37 +0000)
committerbors <bors@rust-lang.org>
Thu, 8 Jun 2017 08:37:48 +0000 (08:37 +0000)
commitf09576c4a41727a8d10bbfd8fd3fb2e10e1be3b3
tree26bbca63feb0c871ae82bf9876fb54d626ca5411
parent76eea743b4b7a1827d921d1dc685f1102c17a1b3
parent345b8332bde78dca7664b1b1b4f4a7284bd70a6d
Auto merge of #42443 - tommyip:better_closure_msg, r=nikomatsakis

Better closure error message

Use tracked data introduced in #42196 to provide a better closure
error message by showing why a closure implements `FnOnce`.

```
error[E0525]: expected a closure that implements the `Fn` trait, but
this closure only implements `FnOnce`
 --> $DIR/issue_26046.rs:4:19
  |
4 |       let closure = move || {
  |  ___________________^
5 | |         vec
6 | |     };
  | |_____^
  |
note: closure is `FnOnce` because it moves the variable `vec` out of
its environment
 --> $DIR/issue_26046.rs:5:9
  |
5 |         vec
  |         ^^^

error: aborting due to previous error(s)
```

Fixes #26046

r? @nikomatsakis
cc @doomrobo