about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-29 20:16:57 +0000
committerbors <bors@rust-lang.org>2014-10-29 20:16:57 +0000
commit77f44d4a7bf14805fda5fc41310a6aeffda30fd4 (patch)
treeaea7012d4afbf278ae64ce92cff06c3d2a7e00cc /src/libstd/sync
parent4769bca1483839ff9c0ad8353c206d6ee06c50e1 (diff)
parent6ac7fc73f5acfe30c698ea4f8bfc37b30473977e (diff)
downloadrust-77f44d4a7bf14805fda5fc41310a6aeffda30fd4.tar.gz
rust-77f44d4a7bf14805fda5fc41310a6aeffda30fd4.zip
auto merge of #17894 : steveklabnik/rust/fail_to_panic, r=aturon
This in-progress PR implements https://github.com/rust-lang/rust/issues/17489.

I made the code changes in this commit, next is to go through alllllllll the documentation and fix various things.

- Rename column headings as appropriate, `# Panics` for panic conditions and `# Errors` for `Result`s.
- clean up usage of words like 'fail' in error messages

Anything else to add to the list, @aturon ? I think I should leave the actual functions with names like `slice_or_fail` alone, since you'll get to those in your conventions work?

I'm submitting just the code bits now so that we can see it separately, and I also don't want to have to keep re-building rust over and over again if I don't have to :wink: 

Listing all the bits so I can remember as I go:

- [x] compiler-rt
- [x] compiletest
- [x] doc
- [x] driver
- [x] etc
- [x] grammar
- [x] jemalloc
- [x] liballoc
- [x] libarena
- [x] libbacktrace
- [x] libcollections
- [x] libcore
- [x] libcoretest
- [x] libdebug
- [x] libflate
- [x] libfmt_macros
- [x] libfourcc
- [x] libgetopts
- [x] libglob
- [x] libgraphviz
- [x] libgreen
- [x] libhexfloat
- [x] liblibc
- [x] liblog
- [x] libnative
- [x] libnum
- [x] librand
- [x] librbml
- [x] libregex
- [x] libregex_macros
- [x] librlibc
- [x] librustc
- [x] librustc_back
- [x] librustc_llvm
- [x] librustdoc
- [x] librustrt
- [x] libsemver
- [x] libserialize
- [x] libstd
- [x] libsync
- [x] libsyntax
- [x] libterm
- [x] libtest
- [x] libtime
- [x] libunicode
- [x] liburl
- [x] libuuid
- [x] llvm
- [x] rt
- [x] test
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/future.rs18
-rw-r--r--src/libstd/sync/task_pool.rs6
2 files changed, 12 insertions, 12 deletions
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index 621c08fe7bc..36070509432 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -58,7 +58,7 @@ impl<A> Future<A> {
         let state = replace(&mut self.state, Evaluating);
         match state {
             Forced(v) => v,
-            _ => fail!( "Logic error." ),
+            _ => panic!( "Logic error." ),
         }
     }
 
@@ -70,10 +70,10 @@ impl<A> Future<A> {
         */
         match self.state {
             Forced(ref v) => return v,
-            Evaluating => fail!("Recursive forcing of future!"),
+            Evaluating => panic!("Recursive forcing of future!"),
             Pending(_) => {
                 match replace(&mut self.state, Evaluating) {
-                    Forced(_) | Evaluating => fail!("Logic error."),
+                    Forced(_) | Evaluating => panic!("Logic error."),
                     Pending(f) => {
                         self.state = Forced(f());
                         self.get_ref()
@@ -132,7 +132,7 @@ impl<A:Send> Future<A> {
         let (tx, rx) = channel();
 
         spawn(proc() {
-            // Don't fail if the other end has hung up
+            // Don't panic if the other end has hung up
             let _ = tx.send_opt(blk());
         });
 
@@ -193,8 +193,8 @@ mod test {
 
     #[test]
     #[should_fail]
-    fn test_futurefail() {
-        let mut f = Future::spawn(proc() fail!());
+    fn test_future_panic() {
+        let mut f = Future::spawn(proc() panic!());
         let _x: String = f.get();
     }
 
@@ -211,7 +211,7 @@ mod test {
     }
 
     #[test]
-    fn test_dropped_future_doesnt_fail() {
+    fn test_dropped_future_doesnt_panic() {
         struct Bomb(Sender<bool>);
 
         local_data_key!(LOCAL: Bomb)
@@ -224,13 +224,13 @@ mod test {
         }
 
         // Spawn a future, but drop it immediately. When we receive the result
-        // later on, we should never view the task as having failed.
+        // later on, we should never view the task as having panicked.
         let (tx, rx) = channel();
         drop(Future::spawn(proc() {
             LOCAL.replace(Some(Bomb(tx)));
         }));
 
-        // Make sure the future didn't fail the task.
+        // Make sure the future didn't panic the task.
         assert!(!rx.recv());
     }
 }
diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs
index a00eeb1f938..d4a60fb5844 100644
--- a/src/libstd/sync/task_pool.rs
+++ b/src/libstd/sync/task_pool.rs
@@ -42,9 +42,9 @@ impl<T> TaskPool<T> {
     /// `init_fn_factory` returns a function which, given the index of the
     /// task, should return local data to be kept around in that task.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// This function will fail if `n_tasks` is less than 1.
+    /// This function will panic if `n_tasks` is less than 1.
     pub fn new(n_tasks: uint,
                init_fn_factory: || -> proc(uint):Send -> T)
                -> TaskPool<T> {
@@ -96,7 +96,7 @@ fn test_task_pool() {
 
 #[test]
 #[should_fail]
-fn test_zero_tasks_failure() {
+fn test_zero_tasks_panic() {
     let f: || -> proc(uint):Send -> uint = || { proc(i) i };
     TaskPool::new(0, f);
 }