Diagnostic deduplication breaks with incr comp
Author: bjorn3Created Sep 17, 2026Updated Sep 17, 2026
LabelsA-diagnosticsT-compilerA-incr-compC-bugD-diagnostic-infra
I tried this code:
tests/ui/allocator/not-an-allocator.rs
#[global_allocator]
static A: usize = 0;
//~^ ERROR E0277
//~| ERROR E0277
//~| ERROR E0277
//~| ERROR E0277
fn main() {}
I expected to see this happen: Both without and with incr comp a single diagnostic.
Instead, this happened: Without incr comp a single diagnostic. With incr comp 4 duplicated diagnostics. With -Zdeduplicate-diagnostics=no in both cases 4 diagnostics are shown, but with incr comp it misses the message that the diagnostics were deduplicated.
Adding some debug prints shows that each diagnostic hashes to a different value with incr comp enabled, yet the debug print of the diagnostics are identical as is the DiagInner::keys() debug print.
Meta
rustc --version --verbose:
rustc 1.100.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.100.0-dev
LLVM version: 23.1.1
c999cef531ea9059e189e82fe0e82c5daf249bc9
Source: rust-lang/rust