about summary refs log tree commit diff
path: root/src/libcore
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/libcore
parentfdef3848a01c4567abd326043b797f6bdc3f3e76 (diff)
downloadrust-d3f9788e596f9b7f07c165e0f382dbe2cdb02b6e.tar.gz
rust-d3f9788e596f9b7f07c165e0f382dbe2cdb02b6e.zip
panic_immediate_abort: Fix issues from review
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/panicking.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs
index 67c0b6ada90..834fcd246c5 100644
--- a/src/libcore/panicking.rs
+++ b/src/libcore/panicking.rs
@@ -40,13 +40,13 @@ use fmt;
 use panic::{Location, PanicInfo};
 
 #[cold]
-// 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))]
 #[lang = "panic"]
 pub fn panic(expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! {
     if cfg!(feature = "panic_immediate_abort") {
         unsafe { super::intrinsics::abort() }
-    };
+    }
 
     // Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially
     // reduce size overhead. The format_args! macro uses str's Display trait to
@@ -59,14 +59,13 @@ pub fn panic(expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! {
 }
 
 #[cold]
-// inline(never) is required even in panic_immediate_abort mode, lest linker error
-#[inline(never)]
+#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
 #[lang = "panic_bounds_check"]
 fn panic_bounds_check(file_line_col: &(&'static str, u32, u32),
                      index: usize, len: usize) -> ! {
     if cfg!(feature = "panic_immediate_abort") {
         unsafe { super::intrinsics::abort() }
-    };
+    }
 
     panic_fmt(format_args!("index out of bounds: the len is {} but the index is {}",
                            len, index), file_line_col)
@@ -78,7 +77,7 @@ fn panic_bounds_check(file_line_col: &(&'static str, u32, u32),
 pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> ! {
     if cfg!(feature = "panic_immediate_abort") {
         unsafe { super::intrinsics::abort() }
-    };
+    }
 
     // NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call
     #[allow(improper_ctypes)] // PanicInfo contains a trait object which is not FFI safe