about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorVitaly _Vi Shukela <vi0oss@gmail.com>2018-11-30 02:17:05 +0300
committerVitaly _Vi Shukela <vi0oss@gmail.com>2018-11-30 02:17:05 +0300
commitd3f9788e596f9b7f07c165e0f382dbe2cdb02b6e (patch)
tree4f7f8d99e49b37f4c82caf7ff9d5c09a9553739d /src/libstd
parentfdef3848a01c4567abd326043b797f6bdc3f3e76 (diff)
downloadrust-d3f9788e596f9b7f07c165e0f382dbe2cdb02b6e.tar.gz
rust-d3f9788e596f9b7f07c165e0f382dbe2cdb02b6e.zip
panic_immediate_abort: Fix issues from review
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/panicking.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs
index 29a0b3feefd..82ceec62f35 100644
--- a/src/libstd/panicking.rs
+++ b/src/libstd/panicking.rs
@@ -335,13 +335,15 @@ pub fn rust_begin_panic(info: &PanicInfo) -> ! {
            reason = "used by the panic! macro",
            issue = "0")]
 #[cold]
+// If panic_immediate_abort, inline the abort call,
+// otherwise avoid inlining because of it is cold path.
 #[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
 #[cfg_attr(    feature="panic_immediate_abort" ,inline)]
 pub fn begin_panic_fmt(msg: &fmt::Arguments,
                        file_line_col: &(&'static str, u32, u32)) -> ! {
     if cfg!(feature = "panic_immediate_abort") {
         unsafe { intrinsics::abort() }
-    };
+    }
 
     let (file, line, col) = *file_line_col;
     let info = PanicInfo::internal_constructor(
@@ -404,14 +406,13 @@ fn continue_panic_fmt(info: &PanicInfo) -> ! {
            reason = "used by the panic! macro",
            issue = "0")]
 #[cfg_attr(not(test), lang = "begin_panic")]
-// avoid code bloat at the call sites as much as possible
-// inline(never) is required even in panic_immediate_abort mode, lest linker error
-#[inline(never)]
+// never inline unless panic_immediate_abort to avoid code bloat at the call sites as much as possible
+#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
 #[cold]
 pub fn begin_panic<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32, u32)) -> ! {
     if cfg!(feature = "panic_immediate_abort") {
         unsafe { intrinsics::abort() }
-    };
+    }
 
     // Note that this should be the only allocation performed in this code path.
     // Currently this means that panic!() on OOM will invoke this code path,