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

Changed error message E0408 to new format #36307

Merged
merged 1 commit into from
Oct 15, 2016

Conversation

faebser
Copy link
Contributor

@faebser faebser commented Sep 6, 2016

Followed your text and was able to change the ouput to the new format.
I did not encounter any broken test therefore this is a really small commit.

Thanks for letting me hack on the compiler :)

r? @jonathandturner

@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 @jonathandturner (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.

@faebser
Copy link
Contributor Author

faebser commented Sep 6, 2016

Part of #35233
Fixes #35698

@GuillaumeGomez
Copy link
Member

Thanks for your PR!

You also need to update the corresponding test(s) to reflect your changes. They are located in src/test/compile_fail/.

@sophiajt
Copy link
Contributor

sophiajt commented Sep 8, 2016

@faebser - as @GuillaumeGomez mentions, the test infrastructure has some quirks. One is that the labels aren't tested until you add your first NOTE. You can read about this in the Extra Credit part of the blog post

@faebser
Copy link
Contributor Author

faebser commented Sep 9, 2016

@jonathandturner thanks for the heads up. I will work on the test as soon I have time.

@GuillaumeGomez
Copy link
Member

@faebser: Don't worry, we're not in a hurry. Just comment here once done.

@faebser
Copy link
Contributor Author

faebser commented Sep 22, 2016

@jonathandturner I don't really get where I have to add the note?
If i try to add a note to https://github.com/rust-lang/rust/blob/master/src/test/compile-fail/E0408.rs (which I think is the original test case that you refer to in your blog post) I just get an unexpected note error if i run the test.

@sophiajt
Copy link
Contributor

@faebser - can you add your changes to this PR so we can take a look?

@faebser
Copy link
Contributor Author

faebser commented Sep 25, 2016

@jonathandturner I added my try as a commit to the PR.
Running python src/bootstrap/bootstrap.py --step check-cfail --stage 1 gives the following errors:

failures:

---- [compile-fail] compile-fail/E0408.rs stdout ----

error: /home/faebser/workspace/rust/src/test/compile-fail/E0408.rs:15: unexpected "error": '15:19: 15:23: variable `y` from pattern #1 is not bound in pattern #2 [E0408]'

error: /home/faebser/workspace/rust/src/test/compile-fail/E0408.rs:15: unexpected "note": 'pattern doesn't bind `y`'

error: /home/faebser/workspace/rust/src/test/compile-fail/E0408.rs:14: expected error not found: variable `y` from pattern #2 is not bound in pattern #1

error: /home/faebser/workspace/rust/src/test/compile-fail/E0408.rs:14: expected note not found: pattern doesn't bind `y`

error: 2 unexpected errors found, 2 expected errors not found
status: exit code: 101

@GuillaumeGomez
Copy link
Member

Then fix them? I don't know what to add actually. :-/

@faebser
Copy link
Contributor Author

faebser commented Sep 26, 2016

@GuillaumeGomez: I am sorry but I am a bit lost and I don't really understand how to fix this error. I added them to this PR because @jonathandturner asked me to.

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Sep 26, 2016

The "errors" you see come from src/test/compile-fail/E0408.rs. So, you added annotations (like `//~ ERROR E0408') but some of them aren't matched with the current rustc output (that you updated).

So let's see the first one:

E0408.rs:15: unexpected "error": '15:19: 15:23: variable `y` from pattern #1 is not bound in pattern #2 [E0408]'

It says that an annotation was not found. So let's look to your file:

//~^ ERROR variable `y` from pattern #2 is not bound in pattern #1

It means you expect an error to be thrown by the line before this one (the "^" says it). Better like this?

@faebser
Copy link
Contributor Author

faebser commented Sep 26, 2016

@GuillaumeGomez: thanks for your comment. I also realised that #1 and #2 were the wrong way around thus generating the error.
I added one more test and will try to find the remaining ones tomorrow.

Copy link
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

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

Once these fixed, please squash your commits. If you don't know how to do it, take a look here.

Some(y) | None => {} //~ ERROR E0408
_ => ()
Some(y) | None => {} //~ ERROR variable `y` from pattern #1 is not bound in pattern #2
_ => () //~^ NOTE pattern doesn't bind `y`
Copy link
Member

Choose a reason for hiding this comment

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

Generally, we use "//|" and not "//^" when it's on the same line. I mean that the note is thrown by the same line than the error, so it's the "same" issue. With this way to write it, we have the feeling that it's two different errors.

Also, can you align "//^ NOTE pattern doesn't bind y" with "// ERROR variable y from pattern #1 is not bound in pattern #2" please?

@@ -20,6 +20,6 @@ fn main() {
use bar::foo::{alpha, charlie};
match alpha {
alpha | beta => {} //~ ERROR variable `beta` from pattern #2 is not bound in pattern #1
charlie => {}
charlie => {} //~^ NOTE pattern doesn't bind `beta`
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

@faebser
Copy link
Contributor Author

faebser commented Sep 27, 2016

@GuillaumeGomez can you please review the third test too? thanks

@GuillaumeGomez
Copy link
Member

All good for me. Please squash your commits now.

@KiChjang
Copy link
Member

This looks like it only requires squashing, what's blocking this for 2 weeks?

@GuillaumeGomez
Copy link
Member

No clue. :-/

@faebser
Copy link
Contributor Author

faebser commented Oct 12, 2016

Sorry for the delay, I thought that the squash was okay but after having another look today I saw that it did not work. I am working on fixing it right now.

@faebser
Copy link
Contributor Author

faebser commented Oct 12, 2016

@GuillaumeGomez: squash is okay now

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Oct 13, 2016

📌 Commit 595b754 has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented Oct 13, 2016

⌛ Testing commit 595b754 with merge c80d21d...

@bors
Copy link
Contributor

bors commented Oct 13, 2016

💔 Test failed - auto-linux-cross-opt

@arielb1
Copy link
Contributor

arielb1 commented Oct 13, 2016

@bors retry

@alexcrichton
Copy link
Member

@bors: retry

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Oct 14, 2016
…uillaumeGomez

Changed error message E0408 to new format

Followed your text and was able to change the ouput to the new format.
I did not encounter any broken test therefore this is a really small commit.

Thanks for letting me hack on the compiler :)

r? @jonathandturner
bors added a commit that referenced this pull request Oct 14, 2016
Rollup of 10 pull requests

- Successful merges: #36307, #36755, #36961, #37102, #37115, #37119, #37122, #37123, #37141, #37159
- Failed merges:
@bors bors merged commit 595b754 into rust-lang:master Oct 15, 2016
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.

8 participants