-
Notifications
You must be signed in to change notification settings - Fork 374
how to run cbindgen *after* rust compile? #472
Copy link
Copy link
Open
Labels
Description
Does anyone have recommendations for running cbindgen as post-build step? by using build.rs as recommended by the docs it makes it so when I have basic typos in my Rust code, I sometimes run into parse errors like this:
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseSyntaxError { crate_name: "...", src_path: "...lib.rs", error: Error("expected identifier") }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
instead of pretty rust compiler errors like this:
error: expected one of `!`, `(`, `,`, `>`, `?`, `for`, lifetime, or path, found `*`
--> src/lib.rs:18:14
|
18 | user_data: * mut c_void,
| ^ expected one of 8 possible tokens
there's some discussion of a postbuild.rs in cargo: rust-lang/cargo#545 but also quite a bit of pushback on making cargo build more complex. It would be good to know if other folks have run into this and what solutions might be better than just temporarily renaming build.rs to disable cbindgen, then adding it back in once the Rust code works well.
Reactions are currently unavailable