-
Notifications
You must be signed in to change notification settings - Fork 13.6k
compiletest: Improve diagnostics for line annotation mismatches 2 #144747
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
Conversation
Some changes occurred in src/tools/compiletest cc @jieyouxu |
Looks slightly better to me, especially the separated headers. @RalfJung What do you think? |
That helps a lot, thanks! I am slightly concerned that from the output it looks like it will still sometimes print multiple "reported with different X", which seems like it could drown the output -- these are just guesses at things that might be matching but they could be entirely unrelated, so we should limit the output to reduce the noise caused by wrong guesses. |
That's what I disagree with, #140622 was based on my experience porting |
That's a one-time migration effort, so I don't see why we'd optimize for that. The common cases in my experience are
What is an example of multiple suggestions with the same rank? In the screenshot, the two suggestions at the very bottom are both just confusing to me, I don't see how they could be helpful. Message and kind are completely different, why would we even assume that this is talking about the same error? |
Because in this case if you write |
Okay I can see how if there's an expected diagnostic without a level, and multiple similar diagnostics on that line, there could be multiple matches. But why would it suggest diagnostics that don't even contain |
The duplication is a real problem, yes.
|
Because none of the diagnostics contain |
That's a cute trick, but most of the .rs files don't have nonsense in the annotations, so it seems like an odd point to optimize for. (Also, is it documented? Please make the tool usable for everyone, not just yourself. :) At least in my work, I have to fix existing ui tests much more often than write new ones, and having so many incorrect and duplicate suggestions makes that harder than it was a year ago. The signal-to-noise ratio of the output has gone up significantly. (Ofc I also knew exactly how the old output looked. The new one is a lot easier to interpret when first seeing this, especially after this PR.) I don't think compiletest should take "the message is entirely different" as a signal for "probably the user wrote deliberate nonsense, let's show all the messages". In general that's just not a good assumption. If you want a specific mode where compiletest shows you all the errors on a line so you can copy-paste the text, that should be explicitly requested, not implicitly assumed. Do we allow empty annotations? If not, they could be used as that signal. But I guess we allow them and it means "just any message", so this may need a keyword/sigil of sorts. |
What are the conditions under which is still shows multiple suggestions? Did I understand correctly that in the case of #144590, it would now show only one suggestion? Does it ever show multiple suggestions for |
If there are multiple suggestions with the same rank.
and the ranks are assigned according to that.
Yes, in that example it will show one suggestion in all cases. |
(I'm gonna: r? RalfJung since I wasn't involved in the previous discussions and don't work with the UI suite that much to have strong opinions here). |
Yes, if there are multiple diagnostics containing "stub" reported on different lines (which is unlikely if it's literally "stub").
This is equivalent to |
So it's listing all lines that have a diagnostic that matches the text? That could be extremely verbose if there's many similar / identical diagnostics. At that point it makes much more sense to look at the stderr file and figure out what is going on IMO. Or is it only diagnostics that haven't been matched already? That would be a lot better, but still risks printing a lot of irrelevant output.
Oh interesting, I would have expected this to match all kinds produced by the compiler. |
I wasn't involved in the previous discussions here either, but fundamentally we just don't seem to have consensus on whether the tool should err on the side of being more verbose vs more concise. I would suggest we land this PR (with the nit about colons resolved, if we have consensus on that), since I consider it a clear improvement -- but it shouldn't close the issue as output still seems very verbose in some cases. |
Yeah, I also suggest to land this change, then address the duplication, then maybe reconsider showing the remaining suggestions. |
Yes, only unmatched diagnostics and annotations are shown in this output.
It was like that before #139720, but now not specifying the kind is prohibited, so UNKNOWN doesn't match anything. |
Updated with the added colons (#144747 (comment)). |
Thanks! @bors r+ |
@bors rollup |
compiletest: Improve diagnostics for line annotation mismatches 2 Follow up to rust-lang#140622 based on feedback from rust-lang#144590.
Rollup of 11 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition) - #144478 (Improve formatting of doc code blocks) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - #144756 (detect infinite recursion with tail calls in ctfe) - #144766 (Add human readable name "Cygwin") - #144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) r? `@ghost` `@rustbot` modify labels: rollup
compiletest: Improve diagnostics for line annotation mismatches 2 Follow up to rust-lang#140622 based on feedback from rust-lang#144590.
compiletest: Improve diagnostics for line annotation mismatches 2 Follow up to rust-lang#140622 based on feedback from rust-lang#144590.
Rollup of 12 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #144478 (Improve formatting of doc code blocks) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - #144766 (Add human readable name "Cygwin") - #144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) - #144786 (Cleanup the definition of `group_type`) - #144796 (Add my previous commit name to .mailmap) - #144797 (Update safety comment for new_unchecked in niche_types) r? `@ghost` `@rustbot` modify labels: rollup
compiletest: Improve diagnostics for line annotation mismatches 2 Follow up to rust-lang#140622 based on feedback from rust-lang#144590.
Rollup of 18 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #143771 (Constify some more `Result` functions) - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition) - #144185 (Document guarantees of poisoning) - #144395 (update fortanix tests) - #144478 (Improve formatting of doc code blocks) - #144614 (Fortify RemoveUnneededDrops test.) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - #144756 (detect infinite recursion with tail calls in ctfe) - #144766 (Add human readable name "Cygwin") - #144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) - #144786 (Cleanup the definition of `group_type`) - #144796 (Add my previous commit name to .mailmap) - #144797 (Update safety comment for new_unchecked in niche_types) Failed merges: - #144805 (compiletest: Preliminary cleanup of `ProcRes` printing/unwinding) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 17 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #143771 (Constify some more `Result` functions) - #144185 (Document guarantees of poisoning) - #144395 (update fortanix tests) - #144478 (Improve formatting of doc code blocks) - #144614 (Fortify RemoveUnneededDrops test.) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - #144756 (detect infinite recursion with tail calls in ctfe) - #144766 (Add human readable name "Cygwin") - #144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) - #144786 (Cleanup the definition of `group_type`) - #144796 (Add my previous commit name to .mailmap) - #144797 (Update safety comment for new_unchecked in niche_types) - #144803 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 17 pull requests Successful merges: - rust-lang/rust#132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - rust-lang/rust#143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - rust-lang/rust#143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - rust-lang/rust#143771 (Constify some more `Result` functions) - rust-lang/rust#144185 (Document guarantees of poisoning) - rust-lang/rust#144395 (update fortanix tests) - rust-lang/rust#144478 (Improve formatting of doc code blocks) - rust-lang/rust#144614 (Fortify RemoveUnneededDrops test.) - rust-lang/rust#144703 ([test][AIX] ignore extern_weak linkage test) - rust-lang/rust#144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - rust-lang/rust#144756 (detect infinite recursion with tail calls in ctfe) - rust-lang/rust#144766 (Add human readable name "Cygwin") - rust-lang/rust#144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) - rust-lang/rust#144786 (Cleanup the definition of `group_type`) - rust-lang/rust#144796 (Add my previous commit name to .mailmap) - rust-lang/rust#144797 (Update safety comment for new_unchecked in niche_types) - rust-lang/rust#144803 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Follow up to #140622 based on feedback from #144590.