Filtering spans when emitting json#102922
Conversation
|
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
Could we solve this at the time of registering the suggestion? I would hope we could just add a debug assertion and avoid ever having these suggestions at all. Basically check this in |
|
@oli-obk I have added the assertions for the debug build. I also changed the condition to avoid the emitting of the second suggestion. |
There was a problem hiding this comment.
There's Span::is_empty I think
This comment has been minimized.
This comment has been minimized.
|
Why only a debug assert? Performance doesn't matter for diagnostics. |
because I don't want to start crashing people's compiler. Maybe we could make it a full assert on nightly or sth. |
|
CI seems to have found more cases of such suggestions |
46e051b to
4f48fc1
Compare
I am not quite sure how to do this. Is there already something for that or should I create a new macro? |
There was a problem hiding this comment.
Some useful suggestions are now missing. Maybe check here for emptyness and avoid adding it only then
There was a problem hiding this comment.
I am checking the pre_span which might have the empty span before adding it in inc_dec_standalone_suggest.
if !pre_span.is_empty() {
patches.push((pre_span, String::new()));
}
4f48fc1 to
9e2c2a5
Compare
|
Could this check be expanded from "don't replace empty with empty" to "don't replace any string with the same string"? |
That's ok I think we should just stick with the debug assert for now |
|
That may be annoying to thread through. We don't always have access to the source map. But definitely something to explore. @bors r+ rollup |
… r=oli-obk Filtering spans when emitting json According to the issue rust-lang#102902, we shouldn't emit spans which have an empty span and no suggested replacement.
|
Failed in rollup: #103184 (comment) |
|
Ah looks like clippy also has such suggestions. You can run the clippy tests with |
9e2c2a5 to
2b495d2
Compare
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
|
Thanks this lgtm now. Please squash your commits as they contain a lot of back and forth now. |
3e6f1fb to
28d0312
Compare
|
@oli-obk thank you for your quick reviews! I have rebased it. |
|
@bors r+ rollup |
Rollup of 6 pull requests Successful merges: - rust-lang#102287 (Elaborate supertrait bounds when triggering `unused_must_use` on `impl Trait`) - rust-lang#102922 (Filtering spans when emitting json) - rust-lang#103051 (translation: doc comments with derives, subdiagnostic-less enum variants, more derive use) - rust-lang#103111 (Account for hygiene in typo suggestions, and use them to point to shadowed names) - rust-lang#103260 (Fixup a few tests needing asm support) - rust-lang#103321 (rustdoc: improve appearance of source page navigation bar) Failed merges: - rust-lang#103209 (Diagnostic derives: allow specifying multiple alternative suggestions) r? `@ghost` `@rustbot` modify labels: rollup
… r=oli-obk Filtering spans when emitting json According to the issue rust-lang#102902, we shouldn't emit spans which have an empty span and no suggested replacement.
Rollup of 6 pull requests Successful merges: - rust-lang#102287 (Elaborate supertrait bounds when triggering `unused_must_use` on `impl Trait`) - rust-lang#102922 (Filtering spans when emitting json) - rust-lang#103051 (translation: doc comments with derives, subdiagnostic-less enum variants, more derive use) - rust-lang#103111 (Account for hygiene in typo suggestions, and use them to point to shadowed names) - rust-lang#103260 (Fixup a few tests needing asm support) - rust-lang#103321 (rustdoc: improve appearance of source page navigation bar) Failed merges: - rust-lang#103209 (Diagnostic derives: allow specifying multiple alternative suggestions) r? `@ghost` `@rustbot` modify labels: rollup
According to the issue #102902, we shouldn't emit spans which have an empty span and no suggested replacement.