about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-09-29 08:14:32 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-09-29 08:14:32 -0700
commitea3a3e9a7ff08c53fed1820c988be75769afab30 (patch)
tree0aa7f435444f7c43b30907bc5c380e200ff790a4
parent86b1e6fd8cca63a102b298fb1312447d199a5ccb (diff)
parent3b9732eae7560542c684cb0584e76946faaee0e9 (diff)
downloadrust-ea3a3e9a7ff08c53fed1820c988be75769afab30.tar.gz
rust-ea3a3e9a7ff08c53fed1820c988be75769afab30.zip
rollup merge of #17602 : Tobba/defailbloat-static
-rw-r--r--src/libcore/failure.rs11
-rw-r--r--src/libcore/macros.rs4
-rw-r--r--src/libcore/option.rs2
3 files changed, 8 insertions, 9 deletions
diff --git a/src/libcore/failure.rs b/src/libcore/failure.rs
index f5f45b2f72e..a053c5a839d 100644
--- a/src/libcore/failure.rs
+++ b/src/libcore/failure.rs
@@ -35,6 +35,10 @@ use intrinsics;
 
 // NOTE: remove after next snapshot
 #[cfg(stage0)]
+pub use self::fail_ as fail;
+
+// NOTE: remove after next snapshot
+#[cfg(stage0)]
 #[cold] #[inline(never)] // this is the slow path, always
 #[lang="fail_"]
 fn fail_(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
@@ -50,7 +54,7 @@ fn fail_(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
 #[cfg(not(stage0))]
 #[cold] #[inline(never)] // this is the slow path, always
 #[lang="fail"]
-fn fail(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
+pub fn fail(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
     let (expr, file, line) = *expr_file_line;
     let ref file_line = (file, line);
     format_args!(|args| -> () {
@@ -71,11 +75,6 @@ fn fail_bounds_check(file_line: &(&'static str, uint),
 }
 
 #[cold] #[inline(never)]
-pub fn fail_str(msg: &str, file: &(&'static str, uint)) -> ! {
-    format_args!(|fmt| fail_fmt(fmt, file), "{}", msg)
-}
-
-#[cold] #[inline(never)]
 pub fn fail_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
     #[allow(ctypes)]
     extern {
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index 0f972a67029..17fcf025457 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -17,8 +17,8 @@ macro_rules! fail(
         fail!("{}", "explicit failure")
     );
     ($msg:expr) => ({
-        static _FILE_LINE: (&'static str, uint) = (file!(), line!());
-        ::core::failure::fail_str($msg, &_FILE_LINE)
+        static _MSG_FILE_LINE: (&'static str, &'static str, uint) = ($msg, file!(), line!());
+        ::core::failure::fail(&_MSG_FILE_LINE)
     });
     ($fmt:expr, $($arg:tt)*) => ({
         // a closure can't have return type !, so we need a full
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 77fe55aadee..1e353708730 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -312,7 +312,7 @@ impl<T> Option<T> {
     pub fn expect(self, msg: &str) -> T {
         match self {
             Some(val) => val,
-            None => fail!(msg),
+            None => fail!("{}", msg),
         }
     }