We have compile errors in case both, sgx_tstd and std, are getting imported simultaneously (check out https://github.com/integritee-network/pallets/blob/master/primitives/utils/src/lib.rs#L22-L23). But not in case none get imported, even though at least one is necessary. This is happening very easily by importing a crate with default-features = false but without adding the std nor sgx feature.
This has caused problems already, and it's hard to find the root cause just from the error messages. It might make sense to add a compile error assertion, this way at least the root cause is obvious.
Proposing the following:
#[cfg(all(not(feature = "std"), not(feature = "sgx")))]
compile_error!("Either feature \"std\" or feature \"sgx\" must be enabled");
Alternative: Make crates no_std compatible but declarations, that need sgx_tstd/ std should only be available within the sgx or std feature. This will also report an error where the root cause is fairly obvious.
We have compile errors in case both,
sgx_tstd
andstd
, are getting imported simultaneously (check out https://github.com/integritee-network/pallets/blob/master/primitives/utils/src/lib.rs#L22-L23). But not in case none get imported, even though at least one is necessary. This is happening very easily by importing a crate withdefault-features = false
but without adding thestd
norsgx
feature.This has caused problems already, and it's hard to find the root cause just from the error messages. It might make sense to add a compile error assertion, this way at least the root cause is obvious.
Proposing the following:
Alternative: Make crates
no_std
compatible but declarations, that needsgx_tstd
/std
should only be available within thesgx
orstd
feature. This will also report an error where the root cause is fairly obvious.