Skip to content

If you set RUSTFLAGS, change a file, and run cargo, all dependencies are pulled again #87670

New issue

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

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

Already on GitHub? Sign in to your account

Closed
adamnemecek opened this issue Jul 31, 2021 · 6 comments
Labels
C-bug Category: This is a bug.

Comments

@adamnemecek
Copy link

I set export RUSTFLAGS=-Awarmings in order to suppress warnings (including those from dependencies). If I then run cargo build things work as expected (cargo runs terminates a hitch). However if I change a single file file in the current project, all dependencies are pulled and recompiled again. The expected behavior is that that only the current project would be checked.

I'm on nightly (2021-07-30).

@adamnemecek adamnemecek added the C-bug Category: This is a bug. label Jul 31, 2021
@jyn514
Copy link
Member

jyn514 commented Jul 31, 2021

Warnings in dependencies are already surpressed. They're rebuilt because cargo doesn't know whether your flags will affect the dependent crates, it doesn't inspect the flags to see if you're passing a --cfg or a lint level.

Anyway, this should be a cargo issue, there's nothing rustc can do.

@jyn514
Copy link
Member

jyn514 commented Jul 31, 2021

If you only want to set flags for one crate, you can use cargo rustc. I don't know a way to do it for all path dependencies, though.

@adamnemecek
Copy link
Author

I'm not talking about the first time, I'm talking about after that. I set flags, change file, run cargo, things get rebuilt. I change another file, run cargo and things get rebuilt again.

@jonas-schievink
Copy link
Contributor

This is a known Cargo limitation, see rust-lang/cargo#9055

@adamnemecek
Copy link
Author

It happens not just when you set the flags the first time, but on every recompile after you set the flags.

@jonas-schievink
Copy link
Contributor

I can't reproduce that, but that should also be filed over at https://github.com/rust-lang/cargo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants