Closed jimblandy closed 6 years ago
Note that the #[path]
attribute on modules doesn't seem to do macro expansion on its argument, so something like
#[path=concat!(env!("OUT_DIR"), "/mozilla/mod.rs")]
mod mozilla;
doesn't work either.
It's arguably a Rust bug that include!
is incapable of incorporating text with //!
comments. Fixing that would make this problem go away.
We can probably (optionally) remove the comments from generated file. There are not strictly required.
Alright, so I made it work by not generating all the headers at all.
So I'll put all the write_headers
function as optional in config.
I'll also update the readme for build.rs
The
cargo package
command checks that the build script doesn't modify the source directory; as the Cargo book explains, build scripts are not supposed to modify anything outside the directory given in theOUT_DIR
environment variable.This rule is hard to follow when calling
pb-rs
frombuild.rs
: the only way I'm aware of to incorporate code from OUT_DIR is via aninclude!
directive, but that chokes on the//!
comments thatpb-rs
places at the top of its generated files. When I write:rustc complains: