-
Notifications
You must be signed in to change notification settings - Fork 214
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
We should clarify how e-h-async traits should behave in the face of cancellation #632
Comments
We should definitely mention that I understand the obvious reasons for wanting it, but how often is it an issue in reality? Remember that firstly, it's something the user has to do themselves (and how often does one reach The above is my opinion, and I understand that many people will value complete safety over everything; I think that's a good thing. I also think it's a choice that can be made without being written into the eh contract. |
But I agree that we should acknowledge that reasonable implementations of the e-h-async traits may not follow the soundness rules of rust to the letter, and may cause UB if However, I'd prefer to find some wording that doesn't encourage that choice unconditionally. Even though there are good reasons to deviate from the official Rust rules, it's still a tradeoff that should only be made after carefully considering alternatives. Ideally, users and implementors of the traits should be conservative: Don't rely on |
I think it's actually quite hard in practice for no_std code to violate the stricter version of the pin-drop guarantees that Embassy assumes. Neither The main way with |
Should we specify behaviors for drop/cancellation, or even
mem::forget
for embedded-hal-async methods? This impacts all async methods, as well as things like SpiBus.See https://libera.irclog.whitequark.org/rust-embedded/2024-09-24#1727191016-1727191658; for brief chat conversation history.
Originally posted by @jamesmunns in rust-embedded/wg#796 (comment)
The text was updated successfully, but these errors were encountered: