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

Coreaudio compilation failure - bindings generation fail due to old rustfmt bug #7

Closed
saresend opened this issue Feb 20, 2018 · 6 comments

Comments

@saresend
Copy link

Hey, I'm using coreaudio-sys as a dependency for CPAL, and it seems that the pinned v 0.2.0 is failing to compile with the following error:

error: unexpected close delimiter: `]`
    --> /Users/.../coreaudio-sys-a6bbc6ed7b769743/out/coreaudio.rs:2040:33
     |
2040 | #[derive(Copy, Clone)]; 16usize ] , }#[test]
     |                                 ^

error: Could not compile `coreaudio-sys`.

I can't find other sources of people having this issue, so I'm not sure if it is on my end or not.
Thanks!

@mitchmindtree
Copy link
Member

Hey thanks for the issue!

This seems to be an issue with older versions of rustfmt, could you possibly try updating to the latest rustfmt that ships with rustup?

I actually came across this too, and I can't see us being the only ones. Perhaps we should try catching this error and then re-generating the bindings without running rustfmt for users relying on older versions of the rust tools.

@mitchmindtree mitchmindtree changed the title Coreaudio compilation failure Coreaudio compilation failure - bindings generation fail due to old rustfmt bug Feb 21, 2018
@tomaka
Copy link

tomaka commented Feb 21, 2018

Indeed I don't think it's a good idea to run rustfmt on generated bindings which nobody is going to read anyway!

@saresend
Copy link
Author

Does cargo automatically run rustfmt on dependencies?

@alexander-irbis
Copy link

alexander-irbis commented Mar 11, 2018

A simple workaround if someone has no opportunity to update the rustfmt

--- a/build.rs
+++ b/build.rs
@@ -73,6 +73,7 @@ fn main() {
     let bindings = builder
         .trust_clang_mangling(false)
         .derive_default(true)
+        .rustfmt_bindings(false)
         .generate()
         .expect("unable to generate bindings");

@Rhuagh
Copy link
Collaborator

Rhuagh commented May 20, 2018

Bindgen by default automatically run rust fmt on the generated bindings. This pr disables that automatic fmt

@Rhuagh
Copy link
Collaborator

Rhuagh commented Jun 8, 2018

Fixed by #13 .

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

5 participants