diff options
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/file_unix.rs | 4 | ||||
| -rw-r--r-- | src/libnative/io/pipe_windows.rs | 2 | ||||
| -rw-r--r-- | src/libnative/io/process.rs | 12 | ||||
| -rw-r--r-- | src/libnative/io/timer_unix.rs | 4 | ||||
| -rw-r--r-- | src/libnative/lib.rs | 2 | ||||
| -rw-r--r-- | src/libnative/task.rs | 10 |
6 files changed, 17 insertions, 17 deletions
diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs index 88f5061bbef..f616295c73d 100644 --- a/src/libnative/io/file_unix.rs +++ b/src/libnative/io/file_unix.rs @@ -523,7 +523,7 @@ mod tests { assert_eq!(buf[2], 's' as u8); assert_eq!(buf[3], 't' as u8); } - r => fail!("invalid read: {}", r) + r => panic!("invalid read: {}", r), } assert!(writer.inner_read(buf).is_err()); @@ -547,7 +547,7 @@ mod tests { assert_eq!(buf[2], 's' as u8); assert_eq!(buf[3], 't' as u8); } - r => fail!("invalid read: {}", r) + r => panic!("invalid read: {}", r) } } } diff --git a/src/libnative/io/pipe_windows.rs b/src/libnative/io/pipe_windows.rs index bc08ede39f7..f764470f37d 100644 --- a/src/libnative/io/pipe_windows.rs +++ b/src/libnative/io/pipe_windows.rs @@ -710,7 +710,7 @@ impl UnixAcceptor { if new_handle == libc::INVALID_HANDLE_VALUE { let ret = Err(super::last_error()); // If our disconnection fails, then there's not really a whole lot - // that we can do, so fail the task. + // that we can do, so panic let err = unsafe { libc::DisconnectNamedPipe(handle) }; assert!(err != 0); return ret; diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index d69042175f7..fed4a46b9df 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -600,7 +600,7 @@ fn spawn_process_os(cfg: ProcessConfig, handle: ptr::null_mut() }) } - Ok(..) => fail!("short read on the cloexec pipe"), + Ok(..) => panic!("short read on the cloexec pipe"), }; } // And at this point we've reached a special time in the life of the @@ -944,7 +944,7 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> { let mut status = 0 as c_int; if deadline == 0 { return match retry(|| unsafe { c::waitpid(pid, &mut status, 0) }) { - -1 => fail!("unknown waitpid error: {}", super::last_error().code), + -1 => panic!("unknown waitpid error: {}", super::last_error().code), _ => Ok(translate_status(status)), } } @@ -1069,7 +1069,7 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> { continue } - n => fail!("error in select {} ({})", os::errno(), n), + n => panic!("error in select {} ({})", os::errno(), n), } // Process any pending messages @@ -1149,7 +1149,7 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> { n if n > 0 => { ret = true; } 0 => return true, -1 if util::wouldblock() => return ret, - n => fail!("bad read {} ({})", os::last_os_error(), n), + n => panic!("bad read {} ({})", os::last_os_error(), n), } } } @@ -1172,7 +1172,7 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> { } { 1 => {} -1 if util::wouldblock() => {} // see above comments - n => fail!("bad error on write fd: {} {}", n, os::errno()), + n => panic!("bad error on write fd: {} {}", n, os::errno()), } } } @@ -1192,7 +1192,7 @@ fn waitpid_nowait(pid: pid_t) -> Option<rtio::ProcessExit> { }) { n if n == pid => Some(translate_status(status)), 0 => None, - n => fail!("unknown waitpid error `{}`: {}", n, + n => panic!("unknown waitpid error `{}`: {}", n, super::last_error().code), } } diff --git a/src/libnative/io/timer_unix.rs b/src/libnative/io/timer_unix.rs index 6f57a5e88ba..38895f2a8f9 100644 --- a/src/libnative/io/timer_unix.rs +++ b/src/libnative/io/timer_unix.rs @@ -194,7 +194,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) { } -1 if os::errno() == libc::EINTR as int => {} - n => fail!("helper thread failed in select() with error: {} ({})", + n => panic!("helper thread panicked in select() with error: {} ({})", n, os::last_os_error()) } } @@ -227,7 +227,7 @@ impl Timer { }; while unsafe { libc::nanosleep(&to_sleep, &mut to_sleep) } != 0 { if os::errno() as int != libc::EINTR as int { - fail!("failed to sleep, but not because of EINTR?"); + panic!("failed to sleep, but not because of EINTR?"); } } } diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index c99143f0a5d..4da088cccb3 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -142,7 +142,7 @@ pub fn start(argc: int, argv: *const *const u8, main: proc()) -> int { exit_code = Some(run(main.take().unwrap())); }).destroy()); unsafe { rt::cleanup(); } - // If the exit code wasn't set, then the task block must have failed. + // If the exit code wasn't set, then the task block must have panicked. return exit_code.unwrap_or(rt::DEFAULT_ERROR_CODE); } diff --git a/src/libnative/task.rs b/src/libnative/task.rs index 455656c09d4..e702c12bdff 100644 --- a/src/libnative/task.rs +++ b/src/libnative/task.rs @@ -297,11 +297,11 @@ mod tests { } #[test] - fn smoke_fail() { + fn smoke_panic() { let (tx, rx) = channel::<()>(); spawn(proc() { let _tx = tx; - fail!() + panic!() }); assert_eq!(rx.recv_opt(), Err(())); } @@ -318,11 +318,11 @@ mod tests { } #[test] - fn smoke_opts_fail() { + fn smoke_opts_panic() { let mut opts = TaskOpts::new(); let (tx, rx) = channel(); opts.on_exit = Some(proc(r) tx.send(r)); - NativeSpawner.spawn(opts, proc() { fail!() }); + NativeSpawner.spawn(opts, proc() { panic!() }); assert!(rx.recv().is_err()); } @@ -365,7 +365,7 @@ mod tests { Some(ops) => { task.put_runtime(ops); } - None => fail!(), + None => panic!(), } Local::put(task); tx.send(()); |
