-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Can not compile windows-rs
when enabling UI_ViewManagement
feature
#3425
Comments
Thanks for reporting this bug. The code generator is failing to add the required I'll get this fixed, but as a workaround you can add the "deprecated" feature to get this to work. windows = { version = "0.59", features = ["UI_ViewManagement", "deprecated"] } |
Thank you so much for your prompt response! So, does that mean the next version, such as "0.60," will fix this bug? Additionally, I noticed that some function parameter signatures have changed, introducing types like // in function:
pdataobj: windows_core::Ref<'_, IDataObject>,
...
let Some(data) = pdataobj.as_ref() else {
return;
}
// do something with `data` |
I also noticed some inconsistencies when using the feature search tool at https://microsoft.github.io/windows-rs/features/#/0.59.0/search/StorageFile. When I searched for error[E0432]: unresolved import `windows::Storage::StorageFile`
--> crates\fs\src/fs.rs:465:44
|
465 | Storage::{StorageDeleteOption, StorageFile},
| ^^^^^^^^^^^
| |
| no `StorageFile` in `Storage`
| help: a similar name exists in the module: `IStorageFile2`
|
note: found an item that was configured out
--> C:\Users\36477\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-0.59.0\src\Windows\Storage\mod.rs:4255:12
|
4255 | pub struct StorageFile(windows_core::IUnknown);
| ^^^^^^^^^^^
note: the item is gated behind the `Storage_Streams` feature
--> C:\Users\36477\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-0.59.0\src\Windows\Storage\mod.rs:4252:7
|
4252 | #[cfg(feature = "Storage_Streams")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Also, the same thing happens for |
You can typically rely on The feature search index still needs to be updated - will get to that soon. |
Thank you very much for your patient explanation. Your work is truly outstanding. BTW, the new #[async_trait::async_trait]
impl Fs for WindowsFs {
async fn trash_file(&self, path: &str) -> Result<()> {
let file = StorageFile::GetFileFromPathAsync(&HSTRING::from(path))?.await?;
file.DeleteAsync(StorageDeleteOption::Default)?.await?;
Ok(())
}
} The above code fails to compile with the following error: error: future cannot be sent between threads safely
--> src/main.rs:31:58
|
31 | async fn trash_file(&self, path: &str) -> Result<()> {
| __________________________________________________________^
32 | | let file = StorageFile::GetFileFromPathAsync(&HSTRING::from(path))?.await?;
33 | | file.DeleteAsync(StorageDeleteOption::Default)?.await?;
34 | | Ok(())
35 | | }
| |_____^ future created by async block is not `Send`
|
= help: within `{async block@src/main.rs:31:58: 35:6}`, the trait `Send` is not implemented for `NonNull<c_void>`, which is required by `{async block@src/main.rs:31:58: 35:6}: Send`
note: future is not `Send` as this value is used across an await
--> src/main.rs:33:57
|
32 | let file = StorageFile::GetFileFromPathAsync(&HSTRING::from(path))?.await?;
| ---- has type `StorageFile` which is not `Send`
33 | file.DeleteAsync(StorageDeleteOption::Default)?.await?;
| ^^^^^ await occurs here, with `file` maybe used later
= note: required for the cast from `Pin<Box<{async block@src/main.rs:31:58: 35:6}>>` to `Pin<Box<dyn Future<Output = Result<(), anyhow::Error>> + Send>>` The error message indicates that |
Let's keep this issue focused on build issues related to feature selection, otherwise it will be hard to track fixes. Feel free to create new issues for other questions or concerns. |
#3431 fixes this issue - please do take it for a spin when you get a moment. |
Summary
When I enable the
UI_ViewManagement
feature to compilewindows-rs
, I encounter some errors. I'm not sure if there are additional steps I should take. Could you kindly advise?Crate manifest
Crate code
The text was updated successfully, but these errors were encountered: