Skip to content

Commit 4e3b9ed

Browse files
committed
constify Location methods
1 parent 4a24f08 commit 4e3b9ed

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

library/core/src/panic/location.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ impl<'a> Location<'a> {
123123
/// ```
124124
#[must_use]
125125
#[stable(feature = "panic_hooks", since = "1.10.0")]
126+
#[rustc_const_unstable(feature = "const_caller_location", issue = "76156")]
126127
#[inline]
127-
pub fn file(&self) -> &str {
128+
pub const fn file(&self) -> &str {
128129
self.file
129130
}
130131

@@ -147,8 +148,9 @@ impl<'a> Location<'a> {
147148
/// ```
148149
#[must_use]
149150
#[stable(feature = "panic_hooks", since = "1.10.0")]
151+
#[rustc_const_unstable(feature = "const_caller_location", issue = "76156")]
150152
#[inline]
151-
pub fn line(&self) -> u32 {
153+
pub const fn line(&self) -> u32 {
152154
self.line
153155
}
154156

@@ -171,8 +173,9 @@ impl<'a> Location<'a> {
171173
/// ```
172174
#[must_use]
173175
#[stable(feature = "panic_col", since = "1.25.0")]
176+
#[rustc_const_unstable(feature = "const_caller_location", issue = "76156")]
174177
#[inline]
175-
pub fn column(&self) -> u32 {
178+
pub const fn column(&self) -> u32 {
176179
self.col
177180
}
178181
}

0 commit comments

Comments
 (0)