Skip to content

Commit aa70115

Browse files
committed
Extend closure special-casing for generators.
This commit extends existing special-casing of closures to highlight the use of variables within generators that are causing the generator to borrow them.
1 parent 121320d commit aa70115

File tree

7 files changed

+228
-155
lines changed

7 files changed

+228
-155
lines changed

src/librustc_borrowck/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,12 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
609609
new_loan.span, &nl, old_loan.span, previous_end_span, Origin::Ast),
610610
(ty::UniqueImmBorrow, _) =>
611611
self.bccx.cannot_uniquely_borrow_by_one_closure(
612-
new_loan.span, &nl, &new_loan_msg,
612+
new_loan.span, "closure", &nl, &new_loan_msg,
613613
old_loan.span, &ol_pronoun, &old_loan_msg, previous_end_span, Origin::Ast),
614614
(_, ty::UniqueImmBorrow) => {
615615
let new_loan_str = &new_loan.kind.to_user_str();
616616
self.bccx.cannot_reborrow_already_uniquely_borrowed(
617-
new_loan.span, &nl, &new_loan_msg, new_loan_str,
617+
new_loan.span, "closure", &nl, &new_loan_msg, new_loan_str,
618618
old_loan.span, &old_loan_msg, previous_end_span, Origin::Ast)
619619
}
620620
(..) =>

0 commit comments

Comments
 (0)