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:
@@ -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"),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user