-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate in this macro invocation
labels
#116836
Comments
The issue occurs in this function: rust/compiler/rustc_errors/src/emitter.rs Line 372 in 631a116
where we iterate through primary spans: rust/compiler/rustc_errors/src/emitter.rs Line 375 in 631a116
and potentially insert the same label multiple times: rust/compiler/rustc_errors/src/emitter.rs Line 434 in 631a116
without checking if it has already been inserted in the previous iteration of the loop. As a result we may end up with as many duplicates as there are primary spans. @rustbot claim |
Bisected to nightly-22-06-04 commit[0] 2022-06-02: Auto merge of #97575 - nnethercote:lazify-SourceFile-lines, r=Mark-Simulacrum |
… r=petrochenkov Fix duplicate labels emitted in `render_multispan_macro_backtrace()` This PR replaces the `Vec` used to store labels with an `FxIndexSet` in order to eliminate duplicates Fixes rust-lang#116836
Code
Current output
Desired output
Rationale and extra context
The label
in this macro invocation
should appear only once.Other cases
No response
Anything else?
The number of label repetitions equal the number of primary macro spans in the diagnostic. In the above code we have two primary spans:
Therefore we see two repetitions of the
in this macro invocation
label:If we add another type param to
enum Enum<T1, T2>
to make itenum Enum<T1, T2, T3>
and correspondingly update the macro it will result in three primary spans and therefore we will now see three occurrences of the label.Metadata
rustc 1.72.1 (d5c2e9c 2023-09-13)
binary: rustc
commit-hash: d5c2e9c
commit-date: 2023-09-13
host: x86_64-pc-windows-msvc
release: 1.72.1
LLVM version: 16.0.5
The text was updated successfully, but these errors were encountered: