diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-07-06 20:43:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-06 20:43:24 +0200 |
| commit | d712f67897854f96c1f92165c20fc3ed74d44fa2 (patch) | |
| tree | 51e22978d998483e8e98787b86522542ab2b8986 /compiler/rustc_const_eval | |
| parent | 4755173cf61dfd432d8fb96ea3d09da99fe30283 (diff) | |
| parent | b730bc9f20d9f88972ad13ccdf88b56d8164aeb3 (diff) | |
| download | rust-d712f67897854f96c1f92165c20fc3ed74d44fa2.tar.gz rust-d712f67897854f96c1f92165c20fc3ed74d44fa2.zip | |
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`
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/ops.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs index 0c587220cb7..9574661282b 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -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"); } |
