Closed gmalette closed 1 year ago
I am quite sure async-trait is behaving correctly as far as that code would be concerned. You can try taking this to any of the resources shown in https://www.rust-lang.org/community to get help making sense of what is going on in your specific case.
@dtolnay thanks for looking at this so quickly! If async-trait is behaving correctly, does that mean that nightly isn't? Or is it more that async-trait has limitations that nightly doesn't have?
Disclaimer: I'm quite new to Rust and I may be using some wrong terminology, please bear with me.
I'm trying to extract a new concept from an implementation into a trait and I'm getting a weird behaviour which I can't figure out. I managed to reduce it to this code.
Notice that both implementations of
get_foo
are identical. However, in theimpl Foo for Concrete
case, the code doesn't compile, giving this error:I would expect that, since the non-trait function compiles, this would mean that the
Result
isSend
, and for that to extend to the trait function. Am I missing something?This is using
async-trait
0.1.62, Rust stable 1.66.0If I switch to nightly, remove the
async_trait
annotations, and enable the#![feature(async_fn_in_trait)]
feature, this code compiles without errors.The
Provider
,Ws
, andContractError
types are from https://docs.rs/ethers/latest/ethers/, withComet
being codegen from that crate, if that matters.