about summary refs log tree commit diff
path: root/src/libcore/panic.rs
diff options
context:
space:
mode:
authorAdam Perry <adam.n.perry@gmail.com>2019-10-23 19:30:21 -0700
committerAdam Perry <adam.n.perry@gmail.com>2019-10-27 12:50:58 -0700
commitaec97e050ea5247fa13612399a7a812dbce89ec9 (patch)
treead7ba453a36edd6d6c530dc1fa8eb947b99fdeca /src/libcore/panic.rs
parent743964ad3fe566ca2ce5c2de14f8733887d283fd (diff)
downloadrust-aec97e050ea5247fa13612399a7a812dbce89ec9.tar.gz
rust-aec97e050ea5247fa13612399a7a812dbce89ec9.zip
Panicking infra uses &core::panic::Location.
This allows us to remove `static_panic_msg` from the SSA<->LLVM
boundary, along with its fat pointer representation for &str.

Also changes the signature of PanicInfo::internal_contructor to
avoid copying.

Closes #65856.
Diffstat (limited to 'src/libcore/panic.rs')
-rw-r--r--src/libcore/panic.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libcore/panic.rs b/src/libcore/panic.rs
index 9428ff3ef15..51bbf3a8fd2 100644
--- a/src/libcore/panic.rs
+++ b/src/libcore/panic.rs
@@ -35,7 +35,7 @@ use crate::fmt;
 pub struct PanicInfo<'a> {
     payload: &'a (dyn Any + Send),
     message: Option<&'a fmt::Arguments<'a>>,
-    location: Location<'a>,
+    location: &'a Location<'a>,
 }
 
 impl<'a> PanicInfo<'a> {
@@ -45,11 +45,16 @@ impl<'a> PanicInfo<'a> {
                 issue = "0")]
     #[doc(hidden)]
     #[inline]
-    pub fn internal_constructor(message: Option<&'a fmt::Arguments<'a>>,
-                                location: Location<'a>)
-                                -> Self {
+    pub fn internal_constructor(
+        message: Option<&'a fmt::Arguments<'a>>,
+        location: &'a Location<'a>,
+    ) -> Self {
         struct NoPayload;
-        PanicInfo { payload: &NoPayload, location, message }
+        PanicInfo {
+            location,
+            message,
+            payload: &NoPayload,
+        }
     }
 
     #[doc(hidden)]
@@ -177,7 +182,7 @@ impl<'a> Location<'a> {
                           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 }
     }