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

Panic when trying to generate non-existing type #396

Open
rylev opened this issue Jan 11, 2021 · 2 comments
Open

Panic when trying to generate non-existing type #396

rylev opened this issue Jan 11, 2021 · 2 comments

Comments

@rylev
Copy link
Contributor

@rylev rylev commented Jan 11, 2021

The error message when trying to generate a type that does not exist is less than ideal:

error: proc macro panicked
  --> bindings\build.rs:2:5
   |
2  | /     winrt::build!(
3  | |         windows::foo::{
4  | |             NoExist,
5  | |             Bar,
...  |
41 | |         }
42 | |     );
   | |______^
   |
   = help: message: Could not find type `Windows.Foo.NoExist"

Note that in a long list of types, if the non-existing type is not one of the first few, it won't even show in the error message span.

@sladyn98
Copy link

@sladyn98 sladyn98 commented Jan 22, 2021

@kennykerr @rylev I would like to take a shot at this issue. IIUC we need to make the error message more helpful. Is one solution here improving the error message ?

@kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Jan 22, 2021

Thanks for you willingness to help! Yes, the error message could be improved, but more importantly the span that indicates where the error occurred needs to be corrected to be the exact sequence of characters that caused the error. Whether it is is a missing module or a missing type, the macro should pinpoint and underline the offending entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants