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

Macro failure only when depending on a project having bindgen as a build dependency. #1287

Closed
leoschwarz opened this issue Mar 28, 2018 · 3 comments

Comments

@leoschwarz
Copy link

As a preamble this might very well be some issue hidden away somewhere and not actually a bug in bindgen, however tracing down the bug is proving to be really hard.

Source code

I setup a reduced (if you think it's worth the effort I can try minimize it further) example here: https://github.com/leoschwarz/bug_2018-03-28

Bindgen Invocation

None other than including it as build-dependency of the subcrate ext_crate.

Actual Results

Rustc fails with a long error message, where some macros lead to code with mismatched types.
If you leave away either the bindgen in ext_crate or the ext_crate dependency in the top level Cargo.toml the code compiles just fine.

Output:

rustc 1.26.0-nightly (9c9424de5 2018-03-27)

rustc 1.24.1 (d3ae9a9e0 2018-02-27)

@emilio
Copy link
Contributor

emilio commented Mar 28, 2018

I suspect something is getting confused... Nom is pulled via bindgen -> cexpr, and probably you're peeking the wrong version or something? Looks really weird.

I can't look into it right now, but I'll try to take a look tomorrow if you haven't figured out.

I'd try to lock nom to a specific version or something. Also, does it happen with all rustc versions?

@leoschwarz
Copy link
Author

leoschwarz commented Mar 28, 2018

Thanks. I've been able to narrow down the issue further, it's not a bindgen issue, sorry, however bindgen depends on nom with the verbose-errors feature which leads to the issue (nom has different error types with and without the flag) only occuring when I include bindgen. (However I did not assume that having a build dependency select certain features would also include the feature in libraries using it as normal dependency.)

So essentially the iso8601 crate has to be patched to work with verbose-errors or the feature should be disabled for that crate's nom. I'm not sure if the later is possible though.

Edit: Actually I'm not the first one bothered by this, see rust-bakery/nom#544.

@leoschwarz
Copy link
Author

Closing as it is not actually a bug in bindgen, and is apparently fixed in nom 4.

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

No branches or pull requests

2 participants