Incremental Compilation needs to rebuild everything when feature gates are changed #47820
Labels
A-incr-comp
Area: Incremental compilation
C-bug
Category: This is a bug.
P-high
High priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given this example:
main.rs
foo.rs
Without the feature gate
nll
,foo::foo
won't compile, becausevec
is borrowed byvec.push
which doesn't allowvec.len
to borrow it again. Withnll
, this is solved and the code compiles.With the annotation in main.rs,
cargo build
will build everything just fine.After a successful build if we remove
#[feature(nll)]
and executecargo build
again, everything still compiles, even though it shouldn.I think that this is due to incremental compilation. Cargo reuses the old module
foo
instead of recompiling it. If it would recompile it (e.g. after adding a newline to the end of foo.rs), the build breaks as expected.The text was updated successfully, but these errors were encountered: