diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-10 13:46:05 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-15 23:22:06 -0700 |
| commit | c25556865205e6978e6bc9eb0e6d5e151e1a68d9 (patch) | |
| tree | e4b76d3dad3688c127a17937dafb24ae6eeefee6 /src/libstd/rt | |
| parent | cf0619383d2ce0f7bd822f82cf487c7fa33d0b76 (diff) | |
| download | rust-c25556865205e6978e6bc9eb0e6d5e151e1a68d9.tar.gz rust-c25556865205e6978e6bc9eb0e6d5e151e1a68d9.zip | |
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
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/unwind.rs | 18 |
1 files changed, 3 insertions, 15 deletions
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. |
