Skip to content

Commit bf25b5e

Browse files
committed
Explain why a closure is FnOnce in closure errors
1 parent 7748bc6 commit bf25b5e

File tree

1 file changed

+3
-0
lines changed
  • src/librustc_borrowck/borrowck

1 file changed

+3
-0
lines changed

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
597597
if let Ok(ty::ClosureKind::FnOnce) =
598598
ty::queries::closure_kind::try_get(self.tcx, DUMMY_SP, id) {
599599
err.help("closure was moved because it only implements `FnOnce`");
600+
if let Some(&(_kind, Some(span))) = self.tables.closure_kinds.get( ) {
601+
err.span_label(span, "move occured here");
602+
}
600603
false
601604
} else {
602605
true

0 commit comments

Comments
 (0)