From c25556865205e6978e6bc9eb0e6d5e151e1a68d9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 10 May 2014 13:46:05 -0700 Subject: core: Implement unwrap()/unwrap_err() on Result Now that std::fmt is in libcore, it's possible to implement this as an inherit method rather than through extension traits. This commit also tweaks the failure interface of libcore to libstd to what it should be, one method taking &fmt::Arguments --- src/libstd/rt/unwind.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index e10e0716f67..c53346f69ee 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -295,24 +295,12 @@ pub mod eabi { } } -#[cold] -#[no_mangle] -#[cfg(not(test))] -pub extern fn rust_fail_bounds_check(file: *u8, line: uint, - index: uint, len: uint) -> ! { - use str::raw::c_str_to_static_slice; - - let msg = format!("index out of bounds: the len is {} but the index is {}", - len as uint, index as uint); - begin_unwind(msg, unsafe { c_str_to_static_slice(file as *i8) }, line) -} - // Entry point of failure from the libcore crate #[no_mangle] #[cfg(not(test))] -pub extern fn rust_begin_unwind(msg: &str, file: &'static str, line: uint) -> ! { - use str::StrAllocating; - begin_unwind(msg.to_owned(), file, line) +pub extern fn rust_begin_unwind(msg: &fmt::Arguments, + file: &'static str, line: uint) -> ! { + begin_unwind_fmt(msg, file, line) } /// The entry point for unwinding with a formatted message. -- cgit 1.4.1-3-g733a5