]> Untitled Git - bdk/commitdiff
Emit specific compile error if incompatible features are enabled
authorLucas Soriano del Pino <l.soriano.del.pino@gmail.com>
Wed, 3 Feb 2021 06:29:24 +0000 (17:29 +1100)
committerLucas Soriano del Pino <l.soriano.del.pino@gmail.com>
Wed, 3 Feb 2021 07:16:13 +0000 (18:16 +1100)
This is motivated by the feature `electrum` being part of the
`default` features of this crate. It is easy to naively enable
`esplora` and `async-interface` and forget that `electrum` is enabled
by default, running into not so obvious compile errors.

src/lib.rs

index 3221dde7971bd2d19cd0e2a3b90852877a9f6a22..197613af23c72a3bfdda3a7a79523b9b8d1cf822 100644 (file)
@@ -210,6 +210,11 @@ extern crate serde;
 #[macro_use]
 extern crate serde_json;
 
+#[cfg(all(feature = "async-interface", feature = "electrum"))]
+compile_error!(
+    "Features async-interface and electrum are mutually exclusive and cannot be enabled together"
+);
+
 #[cfg(feature = "keys-bip39")]
 extern crate bip39;