Repository: rust
Issue: Unstable fingerprints tracking issue
Labels: P-high,T-compiler,regression-from-stable-to-stable,A-incr-comp

For users hitting this bug: please read [this blog post](https://blog.rust-lang.org/2021/05/10/Rust-1.52.1.html) which discusses what you can do. An excerpt is below:


The Internal Compiler Error asks you to report a bug, and if you can do so, we still want that information. We *want* to know about the cases that are failing.

But regardless of whether or not you file a bug, the problem here can be resolved by either:

 1. deleting your incremental compilation cache (e.g. by running `cargo clean` for the whole project or `cargo clean -p crate-causing-the-error`), or
 2. force incremental compilation to be disabled, by setting `CARGO_INCREMENTAL=0` in your environment or setting `build.incremental` to `false` in your `$HOME/.cargo/config.toml` file (which might also be called `$HOME/.cargo/config`) by adding this:

```
build.incremental = 'false'
```

We recommend that users of 1.52.0 disable incremental compilation, to avoid running into this problem.

We do *not* recommend that users of 1.52.0 downgrade to an earlier version of Rust in response to this problem. There is at least one instance of a silent [miscompilation][issue-82920] caused by incremental compilation that was not caught until we added the fingerprint checking.

[issue-82920]: https://github.com/rust-lang/rust/issues/82920

--------------


I believe the (new) ICEs as a result of improved error detection in the incremental code will land in 1.53 onto stable, which is in 6 weeks. We are unlikely to fix all of the fallout (i.e. all bugs, at least 25 of which are [currently open](https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+unstable+fingerprints), though some are duplicates) by that time and be willing to backport the fixes. I suspect we are also unlikely to want to disable the new assertions; they are catching known unsoundness. I am opening this issue to discuss possible alternatives, which are hopefully more user friendly than the current ICE.

I think one direct improvement is to adjust the panic/assert on encountering this to be a proper compile error, which can tell the user that they should (for example) delete the incremental directory and invoke the compiler again. This is already a significant improvement over the current message, I suspect. We can still ask that they file a bug report.

We should also consider if it's worth considering applying performance-hurting mitigations; it seems definitely true we can drop incremental support on beta/stable until these bugs are fixed, but perhaps a smaller hammer is also viable.

Table of ICEs:

| Issue | Query name | Has MCVE | PR fixing issue | fixed in 1.5x? | PR adding regression test | Done |
| ----- | ---------- | ----------------- | --------------- | -- | ------------------------- | ----- |
| #83259 | `predicates_of` | ✅ | #84233 | 1.53 | #84233 | ✅  |
| ~~#83311~~ | ~~`proc_macro_decls_static`~~ | |  |  |  | N/A |
| #83126 | `extern_mod_stmt_cnum` | [mcve-83126][] | https://github.com/rust-lang/rust/pull/83153 | 1.52 | None yet | ❌ |
| #85197 | `optimized_mir` | [mcve-85197][] | #85211 | 1.54 | #85211 | ✅  |
| #84225| `exported_symbols` | ? | #84226 | 1.53 | None yet | ❌ |
| #85019 | `item_children` | ? | https://github.com/rust-lang/rust/pull/83901 | 1.54 | None yet | ❌ |
| #83538 | `evaluate_obligation` (`EvaluatedToOk` and `EvaluatedToOkModuloRegions`) |  ✅ | https://github.com/rust-lang/rust/pull/85186 | 1.54 | https://github.com/rust-lang/rust/pull/85186 | ✅  |
| #84963 | `evaluate_obligation` (`OverflowError`) |  ✅ | None yet | ? | None yet | ❌ |
|              |  `native_libraries`                         | ? |    #85702 | 1.54 | #85702 | ✅  |
| #85360 | evaluate_obligation | ✅  | #85868 | 1.56 | #91065 | ✅ |

[mcve-83126]: https://github.com/rust-lang/rust/issues/83126#issuecomment-799046427
[mcve-85197]: https://github.com/rust-lang/rust/issues/85197

cc @Aaron1011 (driver of fixing the bugs, I believe)
cc @pnkfelix @wesleywiser (T-compiler leads)
cc @rust-lang/release for awareness