diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-09 10:34:27 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-10-11 06:49:18 -0700 |
| commit | 8b4423b04f519b78e0e9196ae1521531c80c743b (patch) | |
| tree | 713d12f4142749e7699de5c61962ee359a30ca88 /src/libstd/sys.rs | |
| parent | 8015f9c27ec342dbf0b28c9c0c4769d8b3bcfc9f (diff) | |
| download | rust-8b4423b04f519b78e0e9196ae1521531c80c743b.tar.gz rust-8b4423b04f519b78e0e9196ae1521531c80c743b.zip | |
De-pub some private runtime components
This change was waiting for privacy to get sorted out, which should be true now that #8215 has landed. Closes #4427
Diffstat (limited to 'src/libstd/sys.rs')
| -rw-r--r-- | src/libstd/sys.rs | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs index ce1be592d79..10c3fed1d54 100644 --- a/src/libstd/sys.rs +++ b/src/libstd/sys.rs @@ -14,9 +14,10 @@ use c_str::ToCStr; use cast; +use libc::size_t; use libc; -use libc::{c_char, size_t}; use repr; +use rt::task; use str; use unstable::intrinsics; @@ -109,7 +110,7 @@ impl FailWithCause for ~str { fn fail_with(cause: ~str, file: &'static str, line: uint) -> ! { do cause.with_c_str |msg_buf| { do file.with_c_str |file_buf| { - begin_unwind_(msg_buf, file_buf, line as libc::size_t) + task::begin_unwind(msg_buf, file_buf, line as libc::size_t) } } } @@ -119,47 +120,12 @@ impl FailWithCause for &'static str { fn fail_with(cause: &'static str, file: &'static str, line: uint) -> ! { do cause.with_c_str |msg_buf| { do file.with_c_str |file_buf| { - begin_unwind_(msg_buf, file_buf, line as libc::size_t) + task::begin_unwind(msg_buf, file_buf, line as libc::size_t) } } } } -// FIXME #4427: Temporary until rt::rt_fail_ goes away -pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! { - use rt::in_green_task_context; - use rt::task::Task; - use rt::local::Local; - use rt::logging::Logger; - use str::Str; - - unsafe { - // XXX: Bad re-allocations. fail2! needs some refactoring - let msg = str::raw::from_c_str(msg); - let file = str::raw::from_c_str(file); - - if in_green_task_context() { - // Be careful not to allocate in this block, if we're failing we may - // have been failing due to a lack of memory in the first place... - do Local::borrow |task: &mut Task| { - let n = task.name.as_ref().map(|n| n.as_slice()).unwrap_or("<unnamed>"); - format_args!(|args| { task.logger.log(args) }, - "task '{}' failed at '{}', {}:{}", - n, msg.as_slice(), file.as_slice(), line); - } - } else { - rterrln!("failed in non-task context at '{}', {}:{}", - msg, file, line as int); - } - - let task: *mut Task = Local::unsafe_borrow(); - if (*task).unwinder.unwinding { - rtabort!("unwinding again"); - } - (*task).unwinder.begin_unwind(); - } -} - #[cfg(test)] mod tests { use cast; |
