Diagnostic deduplication breaks with incr comp
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/ui/allocator/not-an-allocator.rs and run the reproduction with and without incremental compilation, including -Zdeduplicate-diagnostics=no. Compare diagnostic counts, hashes, and the deduplication message; the fix is complete when incremental compilation matches the expected single-diagnostic behavior and the explicit no-deduplication mode remains consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100