I just ran into this issue when releasing imag. In one of the bin crates I import a file which lives at
/ of the repository. When compiling in
debug mode (normal
cargo build), everything works. When compiling for release (
cargo publish) it fails with this error:
Compiling imag-init v0.6.0 (file:///home/m/archive/development/rust/imag/bin/core/imag-init/target/package/imag-init-0.6.0) error: couldn't read bin/core/imag-init/target/package/imag-init-0.6.0/src/../../../../imagrc.toml: No such file or directory (os error 2) --> bin/core/imag-init/target/package/imag-init-0.6.0/src/main.rs:48:42 | 48 | const CONFIGURATION_STR : &'static str = include_str!("../../../../imagrc.toml"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error error: failed to verify package tarball Caused by: Could not compile `imag-init`. To learn more, run the command again with --verbose.
I’m not sure whether to report this. Is it already known? Is there a way to do this right? Propably a compiletime check which path to use?