Need help with feature gates because Cargo and feature gates are fun (ie NOT)


#1

So implementing std features for dependencies if uuid crate has them enabled, I noticed that sha1 didnt implement std::error::Error for sha1::DigestParseError. Experimenting around, I can’t find any reason why this would be happening. Help in figuring out where I went dumb would be awesome.

sha1 crate has the feature std for bringing std crate into scope and implementing it. In the uuid crate I added a target based feature gate for std where if uuid has both std(which is default) and sha1 (using eithersha1 or v5 features) enabled, sha1's std feature is activated as well. This is shown in the first image at line 52-53. According to this, when cargo doc --features v5 is run, sha1 should implement std features, where the one I am looking for is std::error::Error. However it doesn’t seem to be happening. As you can see by the second post, Error does not show for DigestParseError in Trait Implementations

Relevant uuid PR: https://github.com/uuid-rs/uuid/pull/144


Edit Clarified the post quite a bit


#2

I’m not exactly sure what this post is asking and why any of it is cargo's fault…

It was probably just an oversight that std::error::Error didn’t get implemented for DigestParseError because uuid is no_std aware and the Error trait isn’t available in a no_std environment. If this matters to you then the easiest fix is to just make a PR which adds the Error impl when the crate’s std feature is enabled.


#3

@Michael-F-Bryan I clarified the post for you :slight_smile:

sha1 does have a feature gate and #cfg(feature = "std") test for std implementation, but doesn’t show.


#4

bump… its been a while but we still have no idea where we going wrong… someone halp!

kthanks :slight_smile: