Skip to content

Commit aae6c5d

Browse files
committed
rustc_middle: link span_as_caller_location FIXME to tracking issue #146990
1 parent e9385f9 commit aae6c5d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

compiler/rustc_const_eval/src/util/caller_location.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc_abi::FieldIdx;
22
use rustc_hir::LangItem;
33
use rustc_middle::ty::{self, TyCtxt};
44
use rustc_middle::{bug, mir};
5-
use rustc_span::Symbol;
5+
use rustc_span::{Span, Symbol};
66
use tracing::trace;
77

88
use crate::const_eval::{CanAccessMutGlobal, CompileTimeInterpCx, mk_eval_cx_to_read_const_val};
@@ -54,14 +54,15 @@ fn alloc_caller_location<'tcx>(
5454

5555
pub(crate) fn const_caller_location_provider(
5656
tcx: TyCtxt<'_>,
57+
span: Span,
5758
file: Symbol,
5859
line: u32,
5960
col: u32,
6061
) -> mir::ConstValue {
6162
trace!("const_caller_location: {}:{}:{}", file, line, col);
6263
let mut ecx = mk_eval_cx_to_read_const_val(
6364
tcx,
64-
rustc_span::DUMMY_SP, // FIXME: use a proper span here?
65+
span,
6566
ty::TypingEnv::fully_monomorphized(),
6667
CanAccessMutGlobal::No,
6768
);

compiler/rustc_middle/src/hooks/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ declare_hooks! {
5353
hook try_destructure_mir_constant_for_user_output(val: mir::ConstValue, ty: Ty<'tcx>) -> Option<mir::DestructuredConstant<'tcx>>;
5454

5555
/// Getting a &core::panic::Location referring to a span.
56-
hook const_caller_location(file: rustc_span::Symbol, line: u32, col: u32) -> mir::ConstValue;
56+
hook const_caller_location(span: rustc_span::Span, file: rustc_span::Symbol, line: u32, col: u32) -> mir::ConstValue;
5757

5858
/// Returns `true` if this def is a function-like thing that is eligible for
5959
/// coverage instrumentation under `-Cinstrument-coverage`.

compiler/rustc_middle/src/mir/consts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ impl<'tcx> TyCtxt<'tcx> {
586586
let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
587587
let caller = self.sess.source_map().lookup_char_pos(topmost.lo());
588588
self.const_caller_location(
589+
topmost,
589590
Symbol::intern(
590591
&caller
591592
.file

0 commit comments

Comments
 (0)