I have a project where I store a template configuration file in the application binary using include_str!()
. I did a little refactoring which moved the directory from which the file is included, and the compiler told me:
1 error: couldn't read `app/src/cmdproc/../conf.toml`: No such file or directory (os error 2)
--> app/src/cmdproc/mkconf.rs:6:30
|
6 | const CONF_TOML: &str = include_str!("../conf.toml");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
help: there is a file with the same name in a different directory
|
6 | const CONF_TOML: &str = include_str!("../../conf.toml");
| ~~~~~~~~~~~~~~~~~~
The compiler is even telling me the exact relative path of the file I intended to include.
I thought that was unexpectedly helpful, even for Rust.