Remove some more usages of guess_head_span
This commit is contained in:
parent
4b890f3474
commit
fcfb3e92a0
3 changed files with 19 additions and 32 deletions
|
@ -823,10 +823,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
|
||||
ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind) => {
|
||||
let found_kind = self.closure_kind(closure_substs).unwrap();
|
||||
let closure_span =
|
||||
self.tcx.sess.source_map().guess_head_span(
|
||||
self.tcx.hir().span_if_local(closure_def_id).unwrap(),
|
||||
);
|
||||
let closure_span = self.tcx.def_span(closure_def_id);
|
||||
let mut err = struct_span_err!(
|
||||
self.tcx.sess,
|
||||
closure_span,
|
||||
|
@ -951,9 +948,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
_ => None,
|
||||
};
|
||||
|
||||
let found_span = found_did
|
||||
.and_then(|did| self.tcx.hir().span_if_local(did))
|
||||
.map(|sp| self.tcx.sess.source_map().guess_head_span(sp)); // the sp could be a closure
|
||||
let found_span = found_did.and_then(|did| self.tcx.hir().span_if_local(did));
|
||||
|
||||
if self.reported_closure_mismatch.borrow().contains(&(span, found_span)) {
|
||||
// We check closures twice, with obligations flowing in different directions,
|
||||
|
|
|
@ -1543,7 +1543,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
ty::Generator(..) => "generator",
|
||||
_ => "function",
|
||||
};
|
||||
let span = self.tcx.sess.source_map().guess_head_span(span);
|
||||
let mut err = struct_span_err!(
|
||||
self.tcx.sess,
|
||||
span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue