Closed
Description
Part of #59346
It would be nice to have a UI test for the annotate-snippet emitter, that includes annotations that span multiple files. The goal of this issue is to find and add such a test.
Instructions
A simple way to look for this, would be to add this code:
if annotated_files.len() > 1 {
let filename = primary_lo.file.name.to_string();
eprintln!("annotated_files > 1 in {}", filename);
}
to the top of fn slices_for_files
and then check the failing UI tests.
If there are failing UI tests, it means that those UI tests include a diagnostic that probably spans multiple files.
The next step, is to copy that file (and possible auxiliary files) over into src/test/ui/annotate-snippet/
and add // compile-flags: --error-format human-annotate-rs
to the top of the UI test.
Once that's done, be sure to run the added test and open a PR including the blessed stderr files.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: An issue proposing an enhancement or a PR with one.Call for participation: Help is requested to fix this issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
phansch commentedon Sep 6, 2019
Under the assumption, that we do have an existing UI test with annotations from multiple files, I'm happy to help out anyone who wants to take on this issue. Otherwise we'll have to write a test case ourselves.
@rustbot modify labels to +A-diagnostics, +E-mentor, +E-help-wanted
Rollup merge of rust-lang#64206 - phansch:update_issue_number, r=varkor
Rollup merge of rust-lang#64206 - phansch:update_issue_number, r=varkor
bIgBV commentedon Sep 7, 2019
Hey @phansch I'd like to pick this issue up.
phansch commentedon Sep 8, 2019
@bIgBV sure, it's all yours! Let me know if you have any questions. The
rustc-guide
should help you to get started working on the compiler.bIgBV commentedon Sep 9, 2019
@phansch I made the change suggested in the issue and ran all the ui tests (over 9000!). None of them failed, meaning a new test needs to be written for this specific usecase, correct?
phansch commentedon Sep 9, 2019
Thanks! Unfortunately I just realized I made a mistake in the instructions :/
If it's included in
annotate_snippet_emitter_writer.rs
it will only get executed for UI tests that use the new work-in-progress emitter, which only has one UI test currentlyInstead, you'll want to include the snippet below this line in
emitter.rs
:rust/src/librustc_errors/emitter.rs
Line 1172 in 7eb65df
If you could give that a try too, that would be great!
bIgBV commentedon Sep 9, 2019
Will do!
EDIT: @phansch re-ran it with the new changes, still no failures. I'm guessing that we need to add a new test.
bIgBV commentedon Sep 13, 2019
@phansch looks like edits on github don't generate notifications, apologies. But I retried the tests with the second change you suggested. Still no failing tests.
phansch commentedon Sep 15, 2019
@bIgBV Sorry, been out sick the past couple of days. Thanks for testing again!
It's weird that you don't get failing tests 🤔 Could you try to apply this specific patch?
When you run
./x.py test src/test/ui
with the patch you should see at least 5 failing UI tests (At least I do, but I didn't have time to take a closer look, yet)bIgBV commentedon Sep 18, 2019
Okay, something is weird, after pulling in the latest master and making the exact changes in the patch you provided, there are over 8000 failing tests. I want to check if there is something obviously wrong going on, but I might not get back until tomorrow, as each test run takes close to an hour on my laptop.
12 remaining items