errors: dedup same compiler errors, present them in deterministic order - #413
Open
KyrylR wants to merge 2 commits into
Open
errors: dedup same compiler errors, present them in deterministic order#413KyrylR wants to merge 2 commits into
KyrylR wants to merge 2 commits into
Conversation
KyrylR
force-pushed
the
feat/multi-error-diagnostic-policy
branch
from
September 4, 2026 13:24
c34d7a2 to
5c88010
Compare
KyrylR
marked this pull request as ready for review
September 4, 2026 13:25
LesterEvSe
reviewed
Sep 4, 2026
| #[derive(Debug, Clone, Default)] | ||
| struct DiagnosticIndex { | ||
| identities: HashSet<String>, | ||
| source_order: HashMap<usize, usize>, |
Collaborator
There was a problem hiding this comment.
In this case BTreeMap will be more optimized than HashMap
Suggested change
| source_order: HashMap<usize, usize>, | |
| source_order: BTreeMap<usize, usize>, |
Contributor
There was a problem hiding this comment.
I'm skeptical. We can't make use of the BTreeMap's ordering since the actual presentation order depends on source_rank which uses data outside of the map. So it's a question of whether tree-rebalancing operations are cheaper than siphash operations.
If we are really concerned we can use a custom hasher which just casts the usizes to u64s, and that will definitely be faster than either approach.
In practice I think it doesn't matter at all, and HashMap (a) has a more full-featured API, and (b) communicates to the reader of the code that the order doesn't matter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR is meant to make the reported order of errors deterministic and deduplicated to improve UX