issue = "0")]
#[doc(hidden)]
#[inline]
- pub fn internal_constructor(message: Option<&'a fmt::Arguments<'a>>,
+ pub const fn internal_constructor(message: Option<&'a fmt::Arguments<'a>>,
location: Location<'a>)
-> Self {
struct NoPayload;
///
/// [`fmt::write`]: ../fmt/fn.write.html
#[unstable(feature = "panic_info_message", issue = "44489")]
- pub fn message(&self) -> Option<&fmt::Arguments> {
+ pub const fn message(&self) -> Option<&fmt::Arguments> {
self.message
}
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_hooks", since = "1.10.0")]
- pub fn location(&self) -> Option<&Location> {
+ pub const fn location(&self) -> Option<&Location> {
// NOTE: If this is changed to sometimes return None,
// deal with that case in std::panicking::default_hook and std::panicking::begin_panic_fmt.
Some(&self.location)
and related macros",
issue = "0")]
#[doc(hidden)]
- pub fn internal_constructor(file: &'a str, line: u32, col: u32) -> Self {
+ pub const fn internal_constructor(file: &'a str, line: u32, col: u32) -> Self {
Location { file, line, col }
}
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_hooks", since = "1.10.0")]
- pub fn file(&self) -> &str {
+ pub const fn file(&self) -> &str {
self.file
}
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_hooks", since = "1.10.0")]
- pub fn line(&self) -> u32 {
+ pub const fn line(&self) -> u32 {
self.line
}
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_col", since = "1.25.0")]
- pub fn column(&self) -> u32 {
+ pub const fn column(&self) -> u32 {
self.col
}
}