fMeow/maybe-async-rs

Unable to compile a project with two different crates that use maybe_async (one async and another blocking)

Closed this issue · 3 comments

Hi,

I am trying to compile a project that depends on two crates that use maybe-async internally. One crate sets the is_sync flag while the other doesn't. The problem I am having is that the is_sync flag set by one crate is applied also to the other crate that requires async and the project fails to compile. All projects use resolver v2.

I believe this problem was discussed in this Reddit post.

Update: This seems to be due to cargo's feature unification. Here are some possible fixes.

fMeow commented

This is a major known issue. The maybe-async crate just simply violates the additive rules for feature gates.

A possible better solution is to duplicate the marked code to offer both async and sync impl. But this is is not easy, especially I have written a working demo but the compiler error message messed up.

For the time being I'll just duplicate the maybe_async code in a separate crate so the features don't create conflicts. Thanks.