Explain why a closure is FnOnce in closure errors
This commit is contained in:
parent
7748bc665d
commit
bf25b5eb82
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue