-
Notifications
You must be signed in to change notification settings - Fork 745
Permit IntKind::Custom to represent Paths instead of just Idents #1800
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
Conversation
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @emilio (or someone else) soon. |
Looks fair, but could you add a test for this to the |
The actual use-case here is likely to be |
That use case should already be solved by
It should be pretty easy to test without making the crate |
f7addbb
to
d8ed51e
Compare
I'm not entirely sure know what I was thinking—must have been a bad day. Will this suffice? |
bindgen-integration/build.rs
Outdated
@@ -59,6 +59,13 @@ impl ParseCallbacks for MacroCallback { | |||
_ => {} | |||
} | |||
} | |||
|
|||
fn int_macro(&self, _name: &str, _value: i64) -> Option<IntKind> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We somehow need to check this is doing the right thing. What about making this conditional only on _name
(so use it for a single macro), and then use it in a #[test]
function below like let _: isize = MY_MACRO
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opted to verify the type via Any::is
instead, so that failures will still compile (albeit fail the assertion).
d8ed51e
to
ac17fc0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
If one implements
ParseCallbacks::int_macro
to specify a customIntKind
, one is currently restricted to mere Idents which must therefore be brought into the generated bindings' scope; this PR permits paths to be specified instead.r? @emilio