-
Notifications
You must be signed in to change notification settings - Fork 382
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
How to include generated file written under OUT_DIR #673
Comments
I haven't explicitly said how this could be "fixed". I suppose there are two things that could be done:
|
faced the same problem. The solution seems to be to create your own include!(concat!(env!("OUT_DIR"), "/mod.rs")); (this requires gen_mod_rs to be enabled, which is the default since version 3) Rust somehow magically picks the rest of the modules from the outdir. |
Thank you, @matejcik . That's very helpful. I also found this useful example: https://github.com/jgarzik/rust-protobuf-example However, there's one thing I don't understand yet: how But that's a different issue. I'll close this one. |
Recent versions of
protobuf-codegen
seem to enable putting the generated.rs
file underOUT_DIR
(usingcargo_out_dir
), but it's unclear to me how to use the.rs
file when it's underOUT_DIR
. It does not seem to be possible toinclude!
the file because of:the inner attributes (
#!allow(...)
, etc.): see include! macro fails if included file has top-level inner attributes rust-lang/rfcs#752the documentation comment (
//! Generated file from
...)Sorry if this is in the documentation somewhere and I've missed it or if I'm just using the wrong combination of versions.
The text was updated successfully, but these errors were encountered: