diff options
| author | bors <bors@rust-lang.org> | 2014-05-15 23:26:26 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-15 23:26:26 -0700 |
| commit | b545a499fad8d58f858e7c14bcdc90171b97efdf (patch) | |
| tree | e4bebf36fa24fe0fe4dd6846291c59520ef1be28 /src/libstd/rt | |
| parent | 84406d438c6c49aa63875096e5f3cca1a3879f17 (diff) | |
| parent | 2e2160b026d7a2b2d13c3a2b4d6aa073ab3ff43f (diff) | |
| download | rust-b545a499fad8d58f858e7c14bcdc90171b97efdf.tar.gz rust-b545a499fad8d58f858e7c14bcdc90171b97efdf.zip | |
auto merge of #14115 : alexcrichton/rust/core-fmt, r=brson
This was a more difficult change than I thought it would be, and it is unfortunately a breaking change rather than a drop-in replacement. Most of the rationale can be found in the third commit. cc #13851
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/unwind.rs | 24 | ||||
| -rw-r--r-- | src/libstd/rt/util.rs | 3 |
2 files changed, 8 insertions, 19 deletions
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index e10e0716f67..1cc513825a7 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. @@ -402,9 +390,9 @@ fn begin_unwind_inner(msg: Box<Any:Send>, Some(mut stderr) => { Local::put(task); // FIXME: what to do when the task printing fails? - let _err = format_args!(|args| ::fmt::writeln(stderr, args), - "task '{}' failed at '{}', {}:{}", - n, msg_s, file, line); + let _err = write!(stderr, + "task '{}' failed at '{}', {}:{}\n", + n, msg_s, file, line); if backtrace::log_enabled() { let _err = backtrace::write(stderr); } diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index e8b1acb1024..5f9ea14a647 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -110,8 +110,9 @@ impl io::Writer for Stdio { } pub fn dumb_println(args: &fmt::Arguments) { + use io::Writer; let mut w = Stderr; - let _ = fmt::writeln(&mut w as &mut io::Writer, args); + let _ = writeln!(&mut w, "{}", args); } pub fn abort(msg: &str) -> ! { |
