diff --git a/Cargo.lock b/Cargo.lock index 330b3e629a4..b935fa3fcef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2595,6 +2595,7 @@ dependencies = [ "rayon", "serde", "smallvec", + "target-lexicon", "wasmer-compiler", "wasmer-types", "wasmer-vm", diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml index c9083cbf6e6..4bab054c7d2 100644 --- a/lib/compiler-singlepass/Cargo.toml +++ b/lib/compiler-singlepass/Cargo.toml @@ -25,6 +25,9 @@ lazy_static = "1.4" byteorder = "1.3" smallvec = "1.5" +[dev-dependencies] +target-lexicon = { version = "0.11", default-features = false } + [badges] maintenance = { status = "actively-developed" } diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index e66a64e43c4..1228fc46b20 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -176,6 +176,7 @@ fn to_compile_error(x: T) -> CompileError { mod tests { use super::*; use std::str::FromStr; + use target_lexicon::triple; use wasmer_compiler::{CpuFeature, Features, Triple}; use wasmer_vm::{MemoryStyle, TableStyle}; @@ -200,10 +201,7 @@ mod tests { let compiler = SinglepassCompiler::new(Singlepass::default()); // Compile for win64 - let win64 = Target::new( - Triple::from_str("x86_64-pc-windows-msvc").unwrap(), - CpuFeature::for_host(), - ); + let win64 = Target::new(triple!("x86_64-pc-windows-msvc"), CpuFeature::for_host()); let (mut info, translation, inputs) = dummy_compilation_ingredients(); let result = compiler.compile_module(&win64, &mut info, &translation, inputs); match result.unwrap_err() { @@ -212,10 +210,7 @@ mod tests { }; // Compile for 32bit Linux - let linux32 = Target::new( - Triple::from_str("i686-unknown-linux-gnu").unwrap(), - CpuFeature::for_host(), - ); + let linux32 = Target::new(triple!("i686-unknown-linux-gnu"), CpuFeature::for_host()); let (mut info, translation, inputs) = dummy_compilation_ingredients(); let result = compiler.compile_module(&linux32, &mut info, &translation, inputs); match result.unwrap_err() { @@ -224,10 +219,7 @@ mod tests { }; // Compile for win32 - let win32 = Target::new( - Triple::from_str("i686-pc-windows-gnu").unwrap(), - CpuFeature::for_host(), - ); + let win32 = Target::new(triple!("i686-pc-windows-gnu"), CpuFeature::for_host()); let (mut info, translation, inputs) = dummy_compilation_ingredients(); let result = compiler.compile_module(&win32, &mut info, &translation, inputs); match result.unwrap_err() {