diff --git a/ci/runtests.sh b/ci/runtests.sh index 405c0f6..9513526 100755 --- a/ci/runtests.sh +++ b/ci/runtests.sh @@ -18,8 +18,8 @@ cargo check --all-targets --locked cargo clippy --all-targets # stable, std -cargo build --release --features mctp-estack/log -cargo test --features mctp-estack/log +cargo build --release +cargo test # stable, no_std NOSTD_CRATES="mctp pldm pldm-fw" @@ -44,6 +44,6 @@ cargo build --target thumbv7em-none-eabihf --features defmt --no-default-feature cargo build --features log ) -cargo doc --features mctp-estack/log +cargo doc echo success diff --git a/mctp-estack/src/lib.rs b/mctp-estack/src/lib.rs index 6034703..cbf1c8a 100644 --- a/mctp-estack/src/lib.rs +++ b/mctp-estack/src/lib.rs @@ -45,6 +45,11 @@ use heapless::FnvIndexMap; use mctp::{Eid, Error, MsgIC, MsgType, Result, Tag, TagValue}; +#[cfg(not(any(feature = "log", feature = "defmt")))] +compile_error!("Either log or defmt feature must be enabled"); +#[cfg(all(feature = "log", feature = "defmt"))] +compile_error!("log and defmt features are mutually exclusive"); + pub mod control; pub mod fragment; pub mod i2c; @@ -733,9 +738,6 @@ impl EventStamp { } } -#[cfg(not(any(feature = "log", feature = "defmt")))] -compile_error!("Either log or defmt feature must be enabled"); - pub(crate) mod fmt { #[cfg(feature = "defmt")] pub use defmt::{debug, error, info, trace, warn}; diff --git a/mctp-usb-embassy/src/mctpusb.rs b/mctp-usb-embassy/src/mctpusb.rs index e0ca4c6..401b62f 100644 --- a/mctp-usb-embassy/src/mctpusb.rs +++ b/mctp-usb-embassy/src/mctpusb.rs @@ -12,6 +12,8 @@ use log::{debug, error, info, trace, warn}; #[cfg(not(any(feature = "log", feature = "defmt")))] compile_error!("Either log or defmt feature must be enabled"); +#[cfg(all(feature = "log", feature = "defmt"))] +compile_error!("log and defmt features are mutually exclusive"); use core::ops::Range; diff --git a/mctp/src/lib.rs b/mctp/src/lib.rs index 829d15a..7eaf6f6 100644 --- a/mctp/src/lib.rs +++ b/mctp/src/lib.rs @@ -18,6 +18,11 @@ use core::future::Future; +// Currently there is no defmt::Format implementation for std::io::Error +// (can't be derived). If needed that could be manually implemented. +#[cfg(all(feature = "std", feature = "defmt"))] +compile_error!("std and defmt features are currently mutually exclusive"); + /// MCTP endpoint ID #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[cfg_attr(feature = "defmt", derive(defmt::Format))]