Skip to content
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

Switch to async-fn-in-trait #974

Merged
merged 1 commit into from
Nov 25, 2022
Merged

Switch to async-fn-in-trait #974

merged 1 commit into from
Nov 25, 2022

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented Sep 26, 2022

@Dirbaio Dirbaio force-pushed the afit branch 2 times, most recently from 1e1b639 to 90ba465 Compare November 23, 2022 15:59
bors bot added a commit to rust-embedded/embedded-hal that referenced this pull request Nov 23, 2022
407: async: switch to async-fn-in-traits, release v0.2.0-alpha.0 r=eldruin a=Dirbaio

Latest Rust nightlies have somewhat usable async-fn-in-trait support already! 🎉 

embassy-nrf updated here embassy-rs/embassy#974

Paprecuts encountered:

- there's this annoying error [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=f04fca1f2a3d643c323fb49c05bd3ed3), workaround is to use the concrete type instead of `Self::Error`. This is a limitation of all `async fn`s, not just in traits, but it hits especially hard within traits, so I dunno if there's plans to improve it.

> `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope

- The SpiDevice trait ICEs, issue filed rust-lang/rust#102310
- default methods don't work, but there's a PR already rust-lang/rust#102308

Due to the last 2 I've left `SpiDevice` alone for now.

Co-authored-by: Dario Nieuwenhuis <[email protected]>
@Dirbaio Dirbaio marked this pull request as ready for review November 25, 2022 20:03
@Dirbaio Dirbaio changed the title wip: use async-fn-in-traits Switch to async-fn-in-trait Nov 25, 2022
@Dirbaio Dirbaio merged commit fa37452 into master Nov 25, 2022
@bors bors bot deleted the afit branch November 25, 2022 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant