]> git.proxmox.com Git - rustc.git/blobdiff - vendor/rayon-core/src/spawn/mod.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / vendor / rayon-core / src / spawn / mod.rs
index dfa47818ed3e8ad7b7dc2623ed85138dab743134..ae1f211efeeaa3d5e78b14de3e746e1f2963f337 100644 (file)
@@ -73,7 +73,7 @@ where
     F: FnOnce() + Send + 'static,
 {
     // We assert that this does not hold any references (we know
-    // this because of the `'static` bound in the inferface);
+    // this because of the `'static` bound in the interface);
     // moreover, we assert that the code below is not supposed to
     // be able to panic, and hence the data won't leak but will be
     // enqueued into some deque for later execution.
@@ -91,19 +91,14 @@ where
     // executed. This ref is decremented at the (*) below.
     registry.increment_terminate_count();
 
-    Box::new(HeapJob::new({
+    HeapJob::new({
         let registry = Arc::clone(registry);
         move || {
-            match unwind::halt_unwinding(func) {
-                Ok(()) => {}
-                Err(err) => {
-                    registry.handle_panic(err);
-                }
-            }
+            registry.catch_unwind(func);
             registry.terminate(); // (*) permit registry to terminate now
         }
-    }))
-    .as_job_ref()
+    })
+    .into_static_job_ref()
 }
 
 /// Fires off a task into the Rayon threadpool in the "static" or
@@ -148,7 +143,7 @@ where
     F: FnOnce() + Send + 'static,
 {
     // We assert that this does not hold any references (we know
-    // this because of the `'static` bound in the inferface);
+    // this because of the `'static` bound in the interface);
     // moreover, we assert that the code below is not supposed to
     // be able to panic, and hence the data won't leak but will be
     // enqueued into some deque for later execution.