1
Fork 0

Inline core::panic::Location methods

This commit is contained in:
Marko Mijalkovic 2022-04-23 14:41:47 -04:00
parent c212fc4aa7
commit 92a584177d

View file

@ -83,6 +83,7 @@ impl<'a> Location<'a> {
#[stable(feature = "track_caller", since = "1.46.0")] #[stable(feature = "track_caller", since = "1.46.0")]
#[rustc_const_unstable(feature = "const_caller_location", issue = "76156")] #[rustc_const_unstable(feature = "const_caller_location", issue = "76156")]
#[track_caller] #[track_caller]
#[inline]
pub const fn caller() -> &'static Location<'static> { pub const fn caller() -> &'static Location<'static> {
crate::intrinsics::caller_location() crate::intrinsics::caller_location()
} }
@ -122,6 +123,7 @@ impl<'a> Location<'a> {
/// ``` /// ```
#[must_use] #[must_use]
#[stable(feature = "panic_hooks", since = "1.10.0")] #[stable(feature = "panic_hooks", since = "1.10.0")]
#[inline]
pub fn file(&self) -> &str { pub fn file(&self) -> &str {
self.file self.file
} }
@ -145,6 +147,7 @@ impl<'a> Location<'a> {
/// ``` /// ```
#[must_use] #[must_use]
#[stable(feature = "panic_hooks", since = "1.10.0")] #[stable(feature = "panic_hooks", since = "1.10.0")]
#[inline]
pub fn line(&self) -> u32 { pub fn line(&self) -> u32 {
self.line self.line
} }
@ -168,6 +171,7 @@ impl<'a> Location<'a> {
/// ``` /// ```
#[must_use] #[must_use]
#[stable(feature = "panic_col", since = "1.25.0")] #[stable(feature = "panic_col", since = "1.25.0")]
#[inline]
pub fn column(&self) -> u32 { pub fn column(&self) -> u32 {
self.col self.col
} }