Explain why a closure is FnOnce in closure errors

This commit is contained in:
Tommy Ip 2017-05-24 17:30:27 +01:00
parent 7748bc665d
commit bf25b5eb82

View file

@ -597,6 +597,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
if let Ok(ty::ClosureKind::FnOnce) =
ty::queries::closure_kind::try_get(self.tcx, DUMMY_SP, id) {
err.help("closure was moved because it only implements `FnOnce`");
if let Some(&(_kind, Some(span))) = self.tables.closure_kinds.get( ) {
err.span_label(span, "move occured here");
}
false
} else {
true