-
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
dedup for duplicate suggestions #118057
dedup for duplicate suggestions #118057
Conversation
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
LL | } | ||
LL | } | ||
LL | | ||
LL ~ foo!(T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously it displayed here as foo!(TT)
.
What about a more permanent solution in the diagnostics infra? |
Yes, I think that's sound advice. It can help us eliminate duplicate suggestions. |
| ^ | ||
| | | ||
| not allowed in type signatures | ||
| not allowed in type signatures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth noting that for this case, there's a duplicate label generated by placeholder_types
. As we did previously, the method to eliminate the duplication is to add placeholder_types.dedup()
.
applicability: Applicability, | ||
style: SuggestionStyle, | ||
) -> &mut Self { | ||
suggestion.dedup(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we dedup after sorting? In case we have [(first span, first stuff), (second span, second stuff), (first span, first stuff)]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great tips! Before this, I always assumed that Vec::dedup
was equivalent to Vec::from(HashSet::from(vector))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not sort suggestions twice. They are already sorted by span a few lines below.
@bors r+ |
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#117953 (Add more SIMD platform-intrinsics) - rust-lang#118057 (dedup for duplicate suggestions) - rust-lang#118638 (More `rustc_mir_dataflow` cleanups) - rust-lang#118702 (Strengthen well known check-cfg names and values test) - rust-lang#118734 (Unescaping cleanups) - rust-lang#118766 (Lower some forgotten spans) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#118057 - bvanjoi:fix-118048, r=cjgillot dedup for duplicate suggestions Fixes rust-lang#118048 An easy fix.
…mpiler-errors Fix the dedup error because of spans from suggestion Fixes rust-lang#116502 I believe this kind of issue is supposed resolved by rust-lang#118057, but the `==` in `span` respect syntax context, here we should only care that they point to the same bytes of source text, so should use `source_equal`.
Rollup merge of rust-lang#125135 - chenyukang:yukang-fix-116502, r=compiler-errors Fix the dedup error because of spans from suggestion Fixes rust-lang#116502 I believe this kind of issue is supposed resolved by rust-lang#118057, but the `==` in `span` respect syntax context, here we should only care that they point to the same bytes of source text, so should use `source_equal`.
Fixes #118048
An easy fix.