Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cargo should detect changes of RUSTC_LOG #15194

Open
dev-ardi opened this issue Feb 17, 2025 · 2 comments
Open

Cargo should detect changes of RUSTC_LOG #15194

dev-ardi opened this issue Feb 17, 2025 · 2 comments
Labels
A-rebuild-detection Area: rebuild detection and fingerprinting C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@dev-ardi
Copy link

Problem

Cargo does a really good job at detecting whether to rebuild or not to rebuild, but one of the things that are missing is the internal RUSTC_LOG env variable.

Proposed Solution

No response

Notes

I can try to drive this forward as my first contribution, looks easy enough.

@dev-ardi dev-ardi added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Feb 17, 2025
@epage epage added the A-rebuild-detection Area: rebuild detection and fingerprinting label Feb 17, 2025
@epage
Copy link
Contributor

epage commented Feb 17, 2025

Could you describe your proposed solution?

If its to rebuild if that env var changes, then that only helps you when changing the value, I assume.

We could always rebuild when its set so its guaranteed to show the log.

However, for both cases, this runs into intent. Different users can be setting this and have different expectations of what it should do (see logs for everything, see logs for only changed).

This is with me assuming we don't record and replay the log like we do warnings. If we do, then this might make more sense. If we don't, then doing so is another possibility.

@ehuss
Copy link
Contributor

ehuss commented Feb 17, 2025

For my workflow, it usually involves building dependencies without RUSTC_LOG, because that would be too noisy or slow. Then building the crate of interest with RUSTC_LOG. If cargo rebuilt the dependencies, that would make it almost unusable in some situations.

I would agree that the reverse is a little annoying when you want to unset RUSTC_LOG, but cargo caches all the output and repeatedly displays it. However, it isn't too difficult to clear that out of the cache in the rare cases where that happens.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-rebuild-detection Area: rebuild detection and fingerprinting C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants