diff --git a/library/core/src/panic/location.rs b/library/core/src/panic/location.rs index 8eefd9ff20d..26a41036556 100644 --- a/library/core/src/panic/location.rs +++ b/library/core/src/panic/location.rs @@ -123,8 +123,9 @@ pub const fn caller() -> &'static Location<'static> { /// ``` #[must_use] #[stable(feature = "panic_hooks", since = "1.10.0")] + #[rustc_const_unstable(feature = "const_caller_location", issue = "76156")] #[inline] - pub fn file(&self) -> &str { + pub const fn file(&self) -> &str { self.file } @@ -147,8 +148,9 @@ pub fn file(&self) -> &str { /// ``` #[must_use] #[stable(feature = "panic_hooks", since = "1.10.0")] + #[rustc_const_unstable(feature = "const_caller_location", issue = "76156")] #[inline] - pub fn line(&self) -> u32 { + pub const fn line(&self) -> u32 { self.line } @@ -171,8 +173,9 @@ pub fn line(&self) -> u32 { /// ``` #[must_use] #[stable(feature = "panic_col", since = "1.25.0")] + #[rustc_const_unstable(feature = "const_caller_location", issue = "76156")] #[inline] - pub fn column(&self) -> u32 { + pub const fn column(&self) -> u32 { self.col } }