2

feat: Add `CARGO_RUSTC_CURRENT_DIR` (unstable) by epage · Pull Request #12996 ·...

 6 months ago
source link: https://github.com/rust-lang/cargo/pull/12996
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Contributor

What does this PR try to resolve?

This is an alternative to #12158's CARGO_WORKSPACE_DIR that was
implementing the solution to #3946 that previously discussed in the
cargo team meeting.

CARGO_WORKSPACE_DIR is a bit awkward to document / describe because
its the effective workspace directory of the thing being built.
If the thing being built doesn't have a workspace, it falls back to
CARGO_MANIFEST_DIR.

It would also be hard to take into account what the
CARGO_WORKSPACE_DIR would be for path dependencies into foreign
workspaces and it wouldn't solve the problem the user is having.

What the user really wants is the CWD of rustc when it is invoked.
This is much simpler to describe and is accurate when using a path
dependency to a foreign package.

Because the CWD is a much simpler mechanism to talk about, I figured we
could diverge from our prior consensus and make it always present,
rather than limiting it to tests.

How should we test and review this PR?

The preparatory refactor commits have explanation for why they were to help

Additional information

Remaining work for #3946: get this stabilized


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK