Fix borrowck closure span.

This commit is contained in:
Camille GILLOT
2022-06-27 07:33:19 +02:00
parent a950aa24bc
commit 5edc55f99f
10 changed files with 83 additions and 38 deletions

View File

@@ -903,9 +903,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
if let Some(span) = arg {
err.span_label(span, "change this to accept `FnMut` instead of `Fn`");
err.span_label(func.span, "expects `Fn` instead of `FnMut`");
if self.infcx.tcx.sess.source_map().is_multiline(self.body.span) {
err.span_label(self.body.span, "in this closure");
}
err.span_label(self.body.span, "in this closure");
look_at_return = false;
}
}