Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build! macro doesn't have the same syntax as use statements #699

Closed
Awfa opened this issue Apr 13, 2021 · 2 comments · Fixed by #773
Closed

build! macro doesn't have the same syntax as use statements #699

Awfa opened this issue Apr 13, 2021 · 2 comments · Fixed by #773
Labels
enhancement New feature or request

Comments

@Awfa
Copy link

Awfa commented Apr 13, 2021

The build! macro docs say this:

These follow the same convention as Rust use paths.

However, this fails to compile:

windows::build!(
    Windows::Win32::{
        Debug::GetLastError
    }
)

with the following error message:

error: proc macro panicked
  --> src\rust\winapi_wrapper\build.rs:30:5
   |
30 | /     windows::build!(
31 | |         Windows::Win32::{
32 | |             Debug::GetLastError
33 | |         }
34 | |     )
   | |_____^
   |
   = help: message: Could not find namespace `Windows.Win32`

The following does compile however:

windows::build!(
    Windows::Win32::Debug::{
        GetLastError
    }
)

I expect the first one to compile because that's how Rust use paths work.
The error message about not finding the namespace is confusing too.

For context, I ran into this issue when trying to use build! like this:

windows::build!(
    Windows::Win32::{
        Debug::GetLastError,
        Etw::{
            EventRegister,
            EventUnregister,
            EventWrite,
            EVENT_DATA_DESCRIPTOR,
            EVENT_DESCRIPTOR
        },
        ProcessStatus::K32EnumProcesses,
        WindowsProgramming::CloseHandle,
        WindowsEventLog::{
            EvtClose,
            EvtOpenPublisherMetadata,
            EVT_HANDLE
        },
        SystemServices::{
            ERROR_INSUFFICIENT_BUFFER,
            OpenProcess,
            PSTR,
            QueryFullProcessImageNameA,
            TerminateProcess,
        },
    }
)
@kennykerr
Copy link
Collaborator

Glad you found a workaround. Yes, this doesn't work very smoothly today. I'm planning to improve the build parsing soon as the current implementation has a few drawbacks.

@kennykerr kennykerr added the enhancement New feature or request label Apr 14, 2021
@kennykerr
Copy link
Collaborator

This should be fixed as of #773 - let me know if you notice any further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants