Rename fail! to panic!
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
This commit is contained in:
@@ -116,7 +116,7 @@ mod imp {
|
||||
PAGE_SIZE = info.dwPageSize as uint;
|
||||
|
||||
if AddVectoredExceptionHandler(0, vectored_handler) == ptr::null_mut() {
|
||||
fail!("failed to install exception handler");
|
||||
panic!("failed to install exception handler");
|
||||
}
|
||||
|
||||
mem::forget(make_handler());
|
||||
@@ -127,7 +127,7 @@ mod imp {
|
||||
|
||||
pub unsafe fn make_handler() -> Handler {
|
||||
if SetThreadStackGuarantee(&mut 0x5000) == 0 {
|
||||
fail!("failed to reserve stack space for exception handling");
|
||||
panic!("failed to reserve stack space for exception handling");
|
||||
}
|
||||
|
||||
super::Handler { _data: 0i as *mut libc::c_void }
|
||||
@@ -232,7 +232,7 @@ mod imp {
|
||||
pub unsafe fn init() {
|
||||
let psize = libc::sysconf(libc::consts::os::sysconf::_SC_PAGESIZE);
|
||||
if psize == -1 {
|
||||
fail!("failed to get page size");
|
||||
panic!("failed to get page size");
|
||||
}
|
||||
|
||||
PAGE_SIZE = psize as uint;
|
||||
@@ -260,7 +260,7 @@ mod imp {
|
||||
-1,
|
||||
0);
|
||||
if alt_stack == MAP_FAILED {
|
||||
fail!("failed to allocate an alternative stack");
|
||||
panic!("failed to allocate an alternative stack");
|
||||
}
|
||||
|
||||
let mut stack: sigaltstack = mem::zeroed();
|
||||
|
||||
Reference in New Issue
Block a user