Rework rustc output file tracking. by ehuss · Pull Request #8210 · rust-lang/cargo (original) (raw)

This is some cleanup around how Cargo computes the outputs from rustc, and changes how cargo clean -p works. This also includes some minor observable differences detailed below.

clean -p changes

Previously cargo clean -p would build the unit graph and attempt to guess what all the filename hashes are. This has several drawbacks. It incorrectly guesses the hashes in many cases (such as different features). It also tends to cause bugs because it passes every permutation of every setting into Cargo's internals, which may not be prepared to accept unsupported combinations like "test a build-script".

This new implementation uses a strategy of querying rustc for the filename prefix/suffix, and then deletes the files using globs.

cargo clean -p should now be more complete in deleting a package's artifacts, for example:

Internal changes

There are a bunch of internal changes to make Cargo do a better job of tracking the outputs from rustc, and to make the code easier to understand:

Behavioral changes

Cargo now does more complete tracking of the files generated by rustc (and the linker). This means that some files will now be uplifted that previously weren't. It also means they will show up in the artifact JSON notifications. The newly tracked files are:

Some other subtle changes:

Notes

Closes #8149
Closes #6937
Closes #5788
Closes #5375
Closes #3530