From 74e2da30314f599bda4b7af4ddbdf7c88147eb24 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 30 Sep 2024 08:31:20 +1000 Subject: [PATCH] Add compile errors when built with unsupported wasm features --- soroban-sdk/src/lib.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index ed0fc0de..cffa18d7 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -47,16 +47,11 @@ #[cfg(all(target_family = "wasm", feature = "testutils"))] compile_error!("'testutils' feature is not supported on 'wasm' target"); -#[cfg(all( - target_family = "wasm", - any(target_feature = "reference-types", target_feature = "multivalue") -))] -compile_!( - "Compiler configuration is unsupported by Soroban Environment, because a - Wasm feature is enabled that is not yet supported: reference-types, - multivalue. Use Rust 1.81 or older, or disable reference-types or - multivalue." -); +#[cfg(all(target_family = "wasm", target_feature = "reference-types",))] +compile_error!("Compiler configuration is unsupported by Soroban Environment, because a Wasm target-feature is enabled that is not yet supported: reference-types. Use Rust 1.81 or older."); + +#[cfg(all(target_family = "wasm", target_feature = "multivalue",))] +compile_error!("Compiler configuration is unsupported by Soroban Environment, because a Wasm target-feature is enabled that is not yet supported: multivalue. Use Rust 1.81 or older."); // When used in a no_std contract, provide a panic handler as one is required. #[cfg(all(not(feature = "alloc"), target_family = "wasm"))]