Rollup merge of #98519 - TaKO8Ki:add-head-span-field-to-item-and-impl-item, r=cjgillot
Replace some `guess_head_span` with `def_span` This patch fixes a part of #97417. r? `@cjgillot`
This commit is contained in:
commit
d712f67897
40 changed files with 154 additions and 223 deletions
|
@ -155,8 +155,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
|
|||
});
|
||||
|
||||
if let Ok(Some(ImplSource::UserDefined(data))) = implsrc {
|
||||
let span =
|
||||
tcx.sess.source_map().guess_head_span(tcx.def_span(data.impl_def_id));
|
||||
let span = tcx.def_span(data.impl_def_id);
|
||||
err.span_note(span, "impl defined here, but it is not `const`");
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +204,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
|
|||
|
||||
match self_ty.kind() {
|
||||
FnDef(def_id, ..) => {
|
||||
let span = tcx.sess.source_map().guess_head_span(tcx.def_span(*def_id));
|
||||
let span = tcx.def_span(*def_id);
|
||||
if ccx.tcx.is_const_fn_raw(*def_id) {
|
||||
span_bug!(span, "calling const FnDef errored when it shouldn't");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue