about summary refs log tree commit diff
path: root/src/librustdoc/clean/mod.rs
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2014-10-09 15:17:22 -0400
committerSteve Klabnik <steve@steveklabnik.com>2014-10-29 11:43:07 -0400
commit7828c3dd2858d8f3a0448484d8093e22719dbda0 (patch)
tree2d2b106b02526219463d877d480782027ffe1f3f /src/librustdoc/clean/mod.rs
parent3bc545373df4c81ba223a8bece14cbc27eb85a4d (diff)
downloadrust-7828c3dd2858d8f3a0448484d8093e22719dbda0.tar.gz
rust-7828c3dd2858d8f3a0448484d8093e22719dbda0.zip
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]
Diffstat (limited to 'src/librustdoc/clean/mod.rs')
-rw-r--r--src/librustdoc/clean/mod.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index c4d7e85904c..7c8f4ba8f65 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1259,7 +1259,7 @@ impl Clean<Type> for ast::Ty {
             TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
             TyParen(ref ty) => ty.clean(cx),
             TyBot => Bottom,
-            ref x => fail!("Unimplemented type {}", x),
+            ref x => panic!("Unimplemented type {}", x),
         }
     }
 }
@@ -1354,9 +1354,9 @@ impl Clean<Type> for ty::t {
 
             ty::ty_unboxed_closure(..) => Primitive(Unit), // FIXME(pcwalton)
 
-            ty::ty_infer(..) => fail!("ty_infer"),
-            ty::ty_open(..) => fail!("ty_open"),
-            ty::ty_err => fail!("ty_err"),
+            ty::ty_infer(..) => panic!("ty_infer"),
+            ty::ty_open(..) => panic!("ty_open"),
+            ty::ty_err => panic!("ty_err"),
         }
     }
 }
@@ -2068,9 +2068,9 @@ fn name_from_pat(p: &ast::Pat) -> String {
                   which is silly in function arguments");
             "()".to_string()
         },
-        PatRange(..) => fail!("tried to get argument name from PatRange, \
+        PatRange(..) => panic!("tried to get argument name from PatRange, \
                               which is not allowed in function arguments"),
-        PatVec(..) => fail!("tried to get argument name from pat_vec, \
+        PatVec(..) => panic!("tried to get argument name from pat_vec, \
                              which is not allowed in function arguments"),
         PatMac(..) => {
             warn!("can't document the name of a function argument \
@@ -2092,7 +2092,7 @@ fn resolve_type(cx: &DocContext, path: Path,
     debug!("searching for {} in defmap", id);
     let def = match tcx.def_map.borrow().find(&id) {
         Some(&k) => k,
-        None => fail!("unresolved id not in defmap")
+        None => panic!("unresolved id not in defmap")
     };
 
     match def {