1 From e06143d3373293d0490df482261cd4a842f1a5c5 Mon Sep 17 00:00:00 2001
2 From: bjorn3 <bjorn3@users.noreply.github.com>
3 Date: Thu, 3 Oct 2019 16:51:34 +0200
4 Subject: [PATCH] Fix libtest compilation
7 src/libtest/lib.rs | 28 ++++++++--------------------
8 1 file changed, 8 insertions(+), 20 deletions(-)
10 diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
11 index 8b76080..9e65de2 100644
12 --- a/src/libtest/lib.rs
13 +++ b/src/libtest/lib.rs
14 @@ -52,7 +52,7 @@ use std::fmt;
18 - panic::{self, catch_unwind, AssertUnwindSafe, PanicInfo},
19 + panic::{self, PanicInfo},
21 process::{Command, Termination},
22 sync::mpsc::{channel, Sender},
23 @@ -1493,7 +1493,7 @@ pub fn run_test(
26 monitor_ch: Sender<CompletedTest>,
27 - testfn: Box<dyn FnOnce() + Send>,
28 + testfn: Box<impl FnOnce() + Send + 'static>,
31 let concurrency = opts.concurrency;
32 @@ -1509,7 +1509,7 @@ pub fn run_test(
33 // If the platform is single-threaded we're just going to run
34 // the test synchronously, regardless of the concurrency
36 - let supports_threads = !cfg!(target_os = "emscripten") && !cfg!(target_arch = "wasm32");
37 + let supports_threads = false;
38 if concurrency == Concurrent::Yes && supports_threads {
39 let cfg = thread::Builder::new().name(name.as_slice().to_owned());
40 cfg.spawn(runtest).unwrap();
41 @@ -1531,17 +1531,8 @@ pub fn run_test(
42 (benchfn.clone())(harness)
47 - RunStrategy::InProcess => (),
48 - _ => panic!("Cannot run dynamic test fn out-of-process"),
53 - Box::new(move || __rust_begin_short_backtrace(f)),
59 StaticTestFn(f) => run_test_inner(
61 @@ -1604,10 +1592,10 @@ fn get_result_from_exit_code(desc: &TestDesc, code: i32) -> TestResult {
62 fn run_test_in_process(
66 - testfn: Box<dyn FnOnce() + Send>,
67 + testfn: Box<impl FnOnce() + Send + 'static>,
68 monitor_ch: Sender<CompletedTest>,
69 time_opts: Option<time::TestTimeOptions>,
71 // Buffer for capturing standard I/O
72 let data = Arc::new(Mutex::new(Vec::new()));
73 @@ -1623,7 +1611,7 @@ fn run_test_in_process(desc: TestDesc,
77 - let result = catch_unwind(AssertUnwindSafe(testfn));
78 + let result = Ok::<(), Box<dyn std::any::Any + Send>>(testfn());
79 let exec_time = start.map(|start| {
80 let duration = start.elapsed();
81 TestExecTime(duration)
82 @@ -1688,10 +1676,10 @@ fn spawn_test_subprocess(desc: TestDesc, report_time: bool, monitor_ch: Sender<M
83 monitor_ch.send(message).unwrap();
86 fn run_test_in_spawned_subprocess(
88 - testfn: Box<dyn FnOnce() + Send>,
89 + testfn: Box<impl FnOnce() + Send + 'static>,
91 let builtin_panic_hook = panic::take_hook();
92 let record_result = Arc::new(move |panic_info: Option<&'_ PanicInfo<'_>>| {
93 let test_result = match panic_info {