-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
Problem
It looks like cargo fix
sets the environment variable __CARGO_FIX_PLZ
which alters behavior of cargo
invocations with the same environment in a way that makes otherwise functional cargo metadata
invocations fail with
error: could not find .rs file in rustc args
Steps
- Use a proc-macro that calls
cargo metadata
(for example to find the workspace root) - Run
cargo fix
Notes
This came up here: launchbadge/sqlx#1229
The only reason SQLx'es proc-macro code calls cargo metadata
is to find the workspace root. If there was an environment variable for that, akin to CARGO_MANIFEST_DIR
, that proc-macros wouldn't have to call cargo-metadata
in the first place.
Happens both on Stable & Nightly:
cargo 1.53.0 (4369396ce 2021-04-27)
1.55.0-nightly (27277d966 2021-07-16)