1
Fork 0

Use tcx.hir() utils for spans in MIR building.

This corrects the `span_with_body` in the case of closures, which was
incorrectly shortened to the `def_span`.
This commit is contained in:
Camille GILLOT 2022-08-27 14:36:14 +02:00
parent ffe20d61d6
commit 1f370d9437
49 changed files with 352 additions and 298 deletions

View file

@ -360,7 +360,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
diag.span_label(upvar_span, "captured outer variable");
diag.span_label(
self.body.span,
self.infcx.tcx.def_span(def_id),
format!("captured by this `{closure_kind}` closure"),
);