docs.rs icon indicating copy to clipboard operation
docs.rs copied to clipboard

Environment variable from `.cargo/config.toml` not defined at compile time

Open nikableh opened this issue 10 months ago • 1 comments

Crate name

kconfq

Build failure link

https://docs.rs/crate/kconfq/latest/builds/2828035

Additional details

My project has an optional build option that can be set via an env var (is that how you are actually supposed to do build options in cargo?). To give this env variable a default value to use it via env! macro, I have this inside the .cargo/config.toml file:

[env]
# Compile-time default config path for kconfq. Will be tried first before
# falling back to dynamic resolution
DEFAULT_CONFIG_PATH = ""

Locally cargo doc --all-features works fine, but docs.rs fail with a build error.

nikableh avatar Jan 16 '26 21:01 nikableh

Nvm, fixed by using option_env! 🙂

nikableh avatar Jan 16 '26 22:01 nikableh