Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebank
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
This commit is contained in:
commit
eba361ae36
175 changed files with 957 additions and 1341 deletions
|
@ -861,7 +861,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||
let arg_pos = args
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, arg)| arg.span == self.body.span)
|
||||
.filter(|(_, arg)| arg.hir_id == closure_id)
|
||||
.map(|(pos, _)| pos)
|
||||
.next();
|
||||
let def_id = hir.local_def_id(item_id);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue