-
Notifications
You must be signed in to change notification settings - Fork 608
IAsyncOperation<T> no longer Send for some T as of v0.29 #1391
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Just updated to v0.29, tried to compile https://github.com/deviceplug/btleplug with no code changes otherwise, and I'm getting a bunch of errors about IAsyncOperations no longer working due to not implementing Send. v0.28 worked fine.
error: future cannot be sent between threads safely
--> src\winrtble\manager.rs:34:54
|
34 | async fn adapters(&self) -> Result<Vec<Adapter>> {
| ______________________________________________________^
35 | | let adapter_result = BluetoothAdapter::GetDefaultAsync().unwrap().await;
36 | | let adapter = adapter_result.unwrap();
37 | | info!("Adapter ID: {:?}", adapter.DeviceId());
... |
48 | | return Ok(result);
49 | | }
| |_____^ future created by async block is not `Send`
|
= help: within `impl futures::Future`, the trait `std::marker::Send` is not implemented for `NonNull<c_void>`
note: future is not `Send` as it awaits another future which is not `Send`
--> src\winrtble\manager.rs:35:30
|
35 | let adapter_result = BluetoothAdapter::GetDefaultAsync().unwrap().await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `IAsyncOperation<BluetoothAdapter>`, which is not `Send`
= note: required for the cast to the object type `dyn futures::Future<Output = std::result::Result<Vec<Adapter>, Error>> + std::marker::Send`
error: future cannot be sent between threads safely
--> src\winrtble\peripheral.rs:355:43
|
355 | async fn connect(&self) -> Result<()> {
| ___________________________________________^
356 | | let shared_clone = Arc::downgrade(&self.shared);
357 | | let adapter_clone = self.shared.adapter.clone();
358 | | let address = self.shared.address;
... |
380 | | Ok(())
381 | | }
| |_____^ future created by async block is not `Send`
|
= help: within `impl futures::Future`, the trait `std::marker::Send` is not implemented for `NonNull<c_void>`
note: future is not `Send` as it awaits another future which is not `Send`
--> src\winrtble\ble\device.rs:71:30
|
71 | let service_result = async_op.await.map_err(winrt_error)?;
| ^^^^^^^^ await occurs here on type `IAsyncOperation<GattDeviceServicesResult>`, which is not `Send`
= note: required for the cast to the object type `dyn futures::Future<Output = std::result::Result<(), Error>> + std::marker::Send`
error: future cannot be sent between threads safely
--> src\winrtble\peripheral.rs:392:53
|
392 | async fn discover_services(&self) -> Result<()> {
| _____________________________________________________^
393 | | let device = self.shared.device.lock().await;
394 | | if let Some(ref device) = *device {
395 | | let gatt_services = device.discover_services().await?;
... |
422 | | Err(Error::NotConnected)
423 | | }
| |_____^ future created by async block is not `Send`
|
= help: within `impl futures::Future`, the trait `std::marker::Send` is not implemented for `NonNull<c_void>`
note: future is not `Send` as it awaits another future which is not `Send`
--> src\winrtble\ble\device.rs:71:30
|
71 | let service_result = async_op.await.map_err(winrt_error)?;
| ^^^^^^^^ await occurs here on type `IAsyncOperation<GattDeviceServicesResult>`, which is not `Send`
= note: required for the cast to the object type `dyn futures::Future<Output = std::result::Result<(), Error>> + std::marker::Send`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working