Skip to content
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

Stop ignoring expected note/help messages in compiletest suite. #32263

Merged
merged 1 commit into from
Mar 17, 2016

Conversation

frewsxcv
Copy link
Member

Original issue: #21195

Relevant PR: #30778

Prior to this commit, if a compiletest testcase included the text
"HELP:" or "NOTE:" (note the colons), then it would indicate to the
compiletest suite that we should verify "help" and "note" expected
messages.

This commit updates this check to also check "HELP" and "NOTE" (not the
absense of colons) so that we always verify "help" and "note" expected
messages.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@frewsxcv
Copy link
Member Author

/cc @fhahn

(acc_help || ee.kind == "help:", acc_note ||
ee.kind == "note:"));
(acc_help || ee.kind == "help:" || ee.kind == "help",
acc_note || ee.kind == "note:" || ee.kind == "note"));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a separate branch that cleans up this "kind" logic by using enums. I plan to open it up as a follow-up PR if this merges.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should make the opt-in work for note and help as well, but it is still opt-in and notes and help messages are only checked in files with help and note annotations.

When making this changes, it seems like I overlooked note and help (and assumed there is more normalization going on). I think using enums there would make it clearer 👍

@frewsxcv frewsxcv force-pushed the compiletest-ignored-expected branch from 2991d5b to fb96cc8 Compare March 15, 2016 14:17
@@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern: in this expansion of format_args!
// error-pattern: in this expansion of print! (defined in <std macros>)
// field `c_object` of struct `stuff::Item` is private
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure I did this incorrectly. A couple errors in this testcase have errors that report on <std macros> and I'm not sure the best way to handle it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there really isn't a good way, actually. In this case though I'd just remove the NOTEs. the issue in question (#25386) was an ICE, not a test of diagnostics (I'd not include NOTEs unless the purpose is to test that they are emitted, personally)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, that's what I figured, I'll remove them now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in the latest force push.

@frewsxcv
Copy link
Member Author

A little background on this PR: I did a bit of refactoring on compiletest and realized that some help/note messages were being ignored. I noticed this conditional and assumed it was a mistake to not also check "note" and "help", so I fixed the conditional and the relevant test cases (this PR). It wasn't until after I was done that I noticed this issue where it makes it sound like it's opt-in, presumably because it's too much work to add the extra note/help messages? In my opinion, there's no harm in adding them and it could catch diagnostic errors in the future.

@frewsxcv
Copy link
Member Author

On second thought, I think it is still opt-in, but my changes make the opt-in work for both "NOTE" and "HELP" in addition to "NOTE:" and "HELP:"

@frewsxcv
Copy link
Member Author

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned brson Mar 16, 2016
@@ -1013,8 +1013,8 @@ fn check_expected_errors(revision: Option<&str>,
expected_errors.iter()
.fold((false, false),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing, but can't we use any here instead of fold? Seems like it more clearly expresses the intent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this code block:

fn main() {
  let i = 1; //~ NOTE: some note
  let j = 2; //~ HELP: some help 
}

The current implementation checks for note and help in one pass through. I'm not sure how it'd be possible using any unless we were expecting both help and note on the same line. I agree it's not clean, and I'm willing to clean it up, but would rather do that in a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do it in two passes?

On Wed, Mar 16, 2016 at 12:25:23PM -0700, Corey Farwell wrote:

@@ -1013,8 +1013,8 @@ fn check_expected_errors(revision: Option<&str>,
expected_errors.iter()
.fold((false, false),

Given this code block:

fn main() {
  let i = 1; //~ NOTE: some note
  let j = 2; //~ HELP: some help 
}

The current implementation checks for note and help in one pass through. I'm not sure how it'd be possible using any unless we were expecting both help and note on the same line. I agree it's not clean, and I'm willing to clean it up, but would rather do that in a different PR.


You are receiving this because you were assigned.
Reply to this email directly or view it on GitHub:
https://github.com/rust-lang/rust/pull/32263/files/fb96cc8b5d83da8c32cdaf51a5f53edb74152024#r56398787

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spoke with you on IRC. Going to do it in a follow-up PR.

@nikomatsakis
Copy link
Contributor

left some nits, but seems good

@nikomatsakis
Copy link
Contributor

let me know when they're fixed :)

@frewsxcv frewsxcv force-pushed the compiletest-ignored-expected branch from fb96cc8 to 0f8fdba Compare March 16, 2016 20:07
@frewsxcv
Copy link
Member Author

let me know when they're fixed :)

Assuming your only nit was this one, then it's fixed

Original issue: rust-lang#21195

Relevant PR: rust-lang#30778

Prior to this commit, if a compiletest testcase included the text
"HELP:" or "NOTE:" (note the colons), then it would indicate to the
compiletest suite that we should verify "help" and "note" expected
messages.

This commit updates this check to also check "HELP" and "NOTE" (not the
absense of colons) so that we always verify "help" and "note" expected
messages.
@frewsxcv frewsxcv force-pushed the compiletest-ignored-expected branch from 0f8fdba to abd1cea Compare March 17, 2016 03:23
@frewsxcv
Copy link
Member Author

Merge conflicts addressed.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 17, 2016

📌 Commit abd1cea has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Mar 17, 2016

⌛ Testing commit abd1cea with merge be989ac...

bors added a commit that referenced this pull request Mar 17, 2016
…atsakis

Stop ignoring expected note/help messages in compiletest suite.

Original issue: #21195

Relevant PR: #30778

Prior to this commit, if a compiletest testcase included the text
"HELP:" or "NOTE:" (note the colons), then it would indicate to the
compiletest suite that we should verify "help" and "note" expected
messages.

This commit updates this check to also check "HELP" and "NOTE" (not the
absense of colons) so that we always verify "help" and "note" expected
messages.
@bors bors merged commit abd1cea into rust-lang:master Mar 17, 2016
@frewsxcv frewsxcv deleted the compiletest-ignored-expected branch March 17, 2016 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants