I'll also add that I've actually been really impressed with how much attention Rust takes to not break stable packages. Between crater[1] and how aggressively they've cut point releases to fix any issues that (rarely) happen to slip by.
I've been using bindgen for ages on stable and just grabbed the latest version on an empty project and it still works for me.
You shouldn't be using rustfmt-nightly at this point either; install the rustfmt-preview component through rustup. It works on stable!
So yeah looks like I'm tethered to the nightly toolchain after all. :/
Before I ended up going down the TryFrom rabbit hole I ran into two issues with bindgen:
1.) Bindgen segfaults with the ancient LLVM on OSX 10.9. Issue #1006. Solution: use LLVM >= 5 binaries from the LLVM site.
2.) Stable (deprecated) rustfmt causes bindgen to segfault. Solution: cargo install -f rustfmt-nightly. It could be as simple as "stable rustfmt requires --force to run because it's been deprecated", but more helpful error messages would be a great thing here.
(TryFrom is being stabilized fairly soon, it got caught up in some silly stuff but is basically good to go)
Custom { kind: Other, error: StringError("Internal rustfmt error") }
I get the same results if I call the bindgen executable or have build.rs call the bindgen API. I've stuck with having build.rs call the bindgen executable because if I use the bindgen API, compilation is SLOW.
rustup component add rustfmt-preview $ cargo uninstall rustfmt && rustup component add rustfmt-preview
Removing /home/alex/.cargo/bin/cargo-fmt
Removing /home/alex/.cargo/bin/rustfmt
info: downloading component 'rustfmt-preview'
info: installing component 'rustfmt-preview'
$ bindgen bindings.h -- -I/usr/local/include/libr > /dev/null
Custom { kind: Other, error: StringError("Cannot find binary path") }
$ rustc --version
rustc 1.28.0-nightly (29f48ccf3 2018-06-03)
$ cat bindings.h
#include <r_lib.h>
#include <r_asm.h>
#include <r_reg.h>
#include <r_anal.h>
#include <r_bin.h>