Closed cpgddln closed 1 year ago
Seems like a standard library bug.
Minimized:
//use std::collections::HashMap as Map;
use std::collections::BTreeMap as Map;
fn assert_send<T: Send>(_: T) {}
fn main() {
assert_send(async {
let map = Map::<u32, Box<dyn Send + Sync>>::new();
let _iter = map.iter();
async {}.await;
});
}
Apparently this is https://github.com/rust-lang/rust/issues/64552.
Thanks a lot for identifying the root cause in the standard library and even fixing it there, that's awesome!
The following (playground)
results in
however, it works fine when the BTreeMap is replaced by a HashMap. Might that be an issue with
async_trait
, or something I misunderstood?