From 51cf0d1be718469cbf48ee97d4b17ab6d0e26ee5 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Mon, 22 Apr 2019 16:03:04 -0700 Subject: [PATCH 1/3] reduce suggested backends to the ones compiled into wasmer --- src/bin/wasmer.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index b9606a225a7..4b190893317 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -105,7 +105,22 @@ enum Backend { impl Backend { pub fn variants() -> &'static [&'static str] { - &["singlepass", "cranelift", "llvm"] + #[cfg(all(feature = "backend:singlepass", feature = "backend:llvm"))] + { + &["cranelift", "singlepass", "llvm"] + } + #[cfg(all(not(feature = "backend:singlepass"), feature = "backend:llvm"))] + { + &["cranelift", "llvm"] + } + #[cfg(all(feature = "backend:singlepass", not(feature = "backend:llvm")))] + { + &["cranelift", "singlepass"] + } + #[cfg(all(not(feature = "backend:singlepass"), not(feature = "backend:llvm")))] + { + &["cranelift"] + } } } From 015bf7895374222d6cd39b51218cf6f1f77980d7 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Mon, 22 Apr 2019 16:06:22 -0700 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a96a09994e..e66436c7269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All PRs to the Wasmer repository must add to this file. Blocks of changes will separated by version increments. ## **[Unreleased]** +- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends - [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. - [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types - [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering From e8b2660eb7ddcd89fa3d517ed68d9c5479eff3a9 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Mon, 22 Apr 2019 16:14:12 -0700 Subject: [PATCH 3/3] greatly simplify logic -- thanks Lachlan! --- src/bin/wasmer.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 4b190893317..4ab0120451a 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -105,22 +105,13 @@ enum Backend { impl Backend { pub fn variants() -> &'static [&'static str] { - #[cfg(all(feature = "backend:singlepass", feature = "backend:llvm"))] - { - &["cranelift", "singlepass", "llvm"] - } - #[cfg(all(not(feature = "backend:singlepass"), feature = "backend:llvm"))] - { - &["cranelift", "llvm"] - } - #[cfg(all(feature = "backend:singlepass", not(feature = "backend:llvm")))] - { - &["cranelift", "singlepass"] - } - #[cfg(all(not(feature = "backend:singlepass"), not(feature = "backend:llvm")))] - { - &["cranelift"] - } + &[ + "cranelift", + #[cfg(feature = "backend:singlepass")] + "singlepass", + #[cfg(feature = "backend:llvm")] + "llvm", + ] } }