-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Remove Sync requirements on Futures returned in the Rust plugin library. #6490
Fix: Remove Sync requirements on Futures returned in the Rust plugin library. #6490
Conversation
…library. See: bitcoindevkit/bdk#1047 (comment) In general, futures produced by most libraries in the ecosystem of Rust, and bounds placed on users of famous runtimes like tokio and its spawn method all lack Sync requirements. Because of this, anyone who creates a callback using any sort of library that returns a non-Sync future (which most libraries fit this description) inside of it will get some cryptic error messages (async error messages still leave a lot to be desired). Removing these Sync requirements will make the library more useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh, I need to think more hard about this, but at least this should not be a breaking change because we are relaxing the requirements, and also looks like our internal plugin is not doing something that required Sync, but I need to look more into it.
In addition, the current API will have still problems due the Send
requirements, see rust-lang/rust#102211
So theoretically, there should be no possible way this causes a problem.
This is more of a language problem. I have nothing but respect for the async-wg and their work on getting things to be more compatible across the ecosystem, but the problems caused by the superfluous Sync bound are much greater than the small edge case that exists for every async library. |
Yeah, I see your point! To me, this change sounds good also because it is just relaxing the requirements, but I am not sure why this bound was specified, so better wait more expert people on this |
Would you like me to bump the Cargo.toml version to |
I have a couple more changes but will bump as soon as possible 👍 |
Seems like this should go into the current release, @cdecker ? If so, please merge! (Otherwise please fix milestone!) |
See: bitcoindevkit/bdk#1047 (comment)
In general, futures produced by most libraries in the ecosystem of Rust, and bounds placed on users of famous runtimes like tokio and its spawn method all lack Sync requirements.
Because of this, anyone who creates a callback using any sort of library that returns a non-Sync future (which most libraries fit this description) inside of it will get some cryptic error messages (async error messages still leave a lot to be desired).
Removing these Sync requirements will make the library more useful.