Open jplatte opened 3 years ago
We also require CARGO_MANIFEST_DIR
https://github.com/launchbadge/sqlx/blob/af7f2594457e991fd84a97a2170f79801fbdf1df/sqlx-macros/src/query/mod.rs#L54
which is where we look for .env
.
I've been told the working dir that proc macros are executed in is always the workspace root, but assuming that is always the case isn't really any better than requiring these env vars to be set.
We need some way to know the directory to search in for sqlx-data.json
(or .sqlx/
later on) and .env
. Any suggestions?
It's not guaranteed that Rust projects are compiled with cargo, so it would probably good to replace this
.expect()
with a fallback:https://github.com/launchbadge/sqlx/blob/af7f2594457e991fd84a97a2170f79801fbdf1df/sqlx-macros/src/query/mod.rs#L33-L33
CC rust-analyzer/rust-analyzer/issues/7462