1 // Ensure that a `#[track_caller]` function, returning `caller_location()`,
2 // which coerced (to a function pointer) and called, inside a `const fn`,
3 // in turn called, results in the same output irrespective of whether
4 // we're in a const or runtime context.
7 // compile-flags: -Z unleash-the-miri-inside-of-you
9 #![feature(core_intrinsics, const_caller_location)]
11 type L = &'static std::panic::Location<'static>;
14 const fn attributed() -> L {
15 std::intrinsics::caller_location()
18 const fn calling_attributed() -> L {
19 // We need `-Z unleash-the-miri-inside-of-you` for this as we don't have `const fn` pointers.
20 let ptr: fn() -> L = attributed;
25 const CONSTANT: L = calling_attributed();
26 let runtime = calling_attributed();
29 (runtime.file(), runtime.line(), runtime.column()),
30 (CONSTANT.file(), CONSTANT.line(), CONSTANT.column()),