diff options
| author | woppopo <woppopo@protonmail.com> | 2022-08-26 18:14:12 +0900 |
|---|---|---|
| committer | woppopo <woppopo@protonmail.com> | 2022-08-26 18:14:12 +0900 |
| commit | 4e3b9ed337d8088e58ad0aaad503000556b5684b (patch) | |
| tree | 484fa5afa2f0612e408d48b5aa41be31bc0c0c70 | |
| parent | 4a24f08ba43166cfee86d868b3fe8612aec6faca (diff) | |
| download | rust-4e3b9ed337d8088e58ad0aaad503000556b5684b.tar.gz rust-4e3b9ed337d8088e58ad0aaad503000556b5684b.zip | |
constify `Location` methods
| -rw-r--r-- | library/core/src/panic/location.rs | 9 |
1 files changed, 6 insertions, 3 deletions
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 @@ impl<'a> Location<'a> { /// ``` #[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 @@ impl<'a> Location<'a> { /// ``` #[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 @@ impl<'a> Location<'a> { /// ``` #[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 } } |
