Description
After compiling a project that has a reference to an external crate in Cargo.toml
but that is not imported (no extern crate foo;
), a subsequent cargo build
after dropping the unused dependency from Cargo.toml
triggers a full rebuild.
Unless the removal triggers a change in the version of a different dependency in the lock file (which I don't think can currently happen in this scenario), a recompile should be skipped.
(I'd even go further and say that a remote crate imported with extern crate foo
or even #[macro_use] extern crate foo;
that is not actually used and does not introduce build scripts, etc. should also not trigger a rebuild, but that is at least understandable as it can affect type negotiations, etc. in which case it should be more of an "early abort" once the AST has been formed and it becomes possible to determine that no types have changed.)