Closed jocutajar closed 4 years ago
Hi @dtolnay, kindly review.
[SOLVED] Currently when I take my fork as a dependency it fails on syn::* types equality. Any idea? While all is green in async-trait.
[dependencies]
async-trait = { git = "https://github.com/BrightOpen/async-trait.git", branch = "feature/sync-futures-#77" }
results in a few of these:
error[E0369]: binary operation `==` cannot be applied to type `syn::Path`
--> /home/debian/.cargo/git/checkouts/async-trait-47bf8a75611e2af0/0fe069a/src/expand.rs:113:22
|
113 | if attr.path == model.path
| --------- ^^ ---------- syn::Path
| |
| syn::Path
binary operation
==
cannot be applied to typesyn::Path
Solved thanks to @link2xt - added "extra-traits" feature for syn.
Meanwhile, added docs and tests, updated README.md
Hi @dtolnay, thanks for the feedback.
From your example, I understand that an unused value is dropped before the async block is executed. A useful optimization in the discretion of the compiler without effect on functionality. Perhaps the next version of rust will optimize the async fn similarly...
What would happen if you used the variable in the printout or explicitly dropped it after?
I think I'll close for now, since this is pretty hard to review with the unrelated changes included together. Please open a new PR without drop order changes or the readme changes.
The improvements plus better support for 'static
futures are available in a fork samotop-async-trait
#[future_is[BOUNDS]]
attribute for async fns so you can opt in for Sync or 'static futureasync move
block instead of inner function as it removed a whole lot of complexity and enabled the 'static stuff