From 5450f7122ebd026def753f135b3fc161c8f157b7 Mon Sep 17 00:00:00 2001 From: Nick Carton Date: Sat, 13 Jul 2024 22:07:08 +1000 Subject: [PATCH 1/2] Fix panic if attempting to compile with unsupported CPU (eg. x86_64 without AVX or SSE4.2) --- lib/compiler-singlepass/src/compiler.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index 5e723a3cfc8..7e2ea4c20f3 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -129,9 +129,8 @@ impl Compiler for SinglepassCompiler { target, calling_convention, ) - .unwrap() }) - .collect::>() + .collect::, _>>()? .into_iter() .collect(); let (functions, fdes): (Vec, Vec<_>) = function_body_inputs From 42ad918bf250edd5a28d15ebcae641880675600d Mon Sep 17 00:00:00 2001 From: Nick Carton Date: Sat, 13 Jul 2024 22:09:44 +1000 Subject: [PATCH 2/2] Fix other unwraps in compile iterators --- lib/compiler-singlepass/src/compiler.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index 7e2ea4c20f3..3669805bbae 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -211,8 +211,8 @@ impl Compiler for SinglepassCompiler { .values() .collect::>() .into_par_iter_if_rayon() - .map(|func_type| gen_std_trampoline(func_type, target, calling_convention).unwrap()) - .collect::>() + .map(|func_type| gen_std_trampoline(func_type, target, calling_convention)) + .collect::, _>>()? .into_iter() .collect::>(); @@ -227,9 +227,8 @@ impl Compiler for SinglepassCompiler { target, calling_convention, ) - .unwrap() }) - .collect::>() + .collect::, _>>()? .into_iter() .collect::>();