Closed yjhmelody closed 4 years ago
BTW, I fix all of above in my local. But there's still many other errors when built in --no-default-features
for core/trie
.
substrate-trie
for wasm in test-runtime
.substrate-trie
in Cumulus in wasm.So, I don't understand your problems.
Okay, I checked this. I get the same error when I build just the crate. This is probably again some Cargo bug, we can not hack around.
Your linked pr to re-export the no_std
error also is not required. The no_std
error is implemented for every type. Furthermore the rust error message also says that std::error::Error
is not implemented.
It looks like trie crate imports std somewhere, then Error get cast to std error. I would expect following code from 'trie' crate to be enough:
#[cfg(not(feature = "std"))]
impl<T> Error for T {}
It looks like trie crate imports std somewhere, then Error get cast to std error. I would expect following code from 'trie' crate to be enough:
#[cfg(not(feature = "std"))] impl<T> Error for T {}
The problem is the imports of trie-bench
etc, they import trie-db
without disabling the std
feature. Cargo merges all features of dev-dependencies
and dependencies
and then we compile trie-db
with std
enabled, while substrate-trie
is compiled without std
.
Did you read my last comment? That explains it.
Well, I try to understand it.
The question is still, what do you want to achieve here? Why do you build just the substrate-trie
crate?
The client
relies heavily on it. Can easy to build some other client functions if it can built in no_std
.
What? Again, substrate-trie
compiles for Wasm. We already use it in Wasm.
Given that the issue can not be solved by us and that substrate-trie
compiles for Wasm, I will close this issue.
I run following cmd to build
core/trie
I find that
core/trie
has not impl forno_std
.See https://github.com/paritytech/substrate/blob/master/core/trie/src/error.rs#L11
The
trie-db
has not reexport theno_std
Error. And I open a PR to fix it. https://github.com/paritytech/trie/pull/31