Skip to content

Unstable Book: const_caller_location leads to a closed tracking issue #76105

@ArekPiekarz

Description

@ArekPiekarz

In Unstable Book the section const_caller_location leads to a closed tracking issue #47809 about a general caller tracking. There is a forked new issue about tracking callers for closures, but it seems unrelated to working in const functions.

This functionality is still not stabilized, because trying to use it like this:

#[track_caller]
const fn foo() -> &'static std::panic::Location<'static> {
    std::panic::Location::caller()
}

gives error:

error: `std::panic::Location::<'a>::caller` is not yet stable as a const fn
 --> src/lib.rs:3:5
  |
3 |     std::panic::Location::caller()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(const_caller_location)]` to the crate attributes to enable

Thus it looks like const_caller_location should have its own tracking issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions