-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
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. |
Thanks for your PR! You also need to update the corresponding test(s) to reflect your changes. They are located in |
@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 |
@jonathandturner thanks for the heads up. I will work on the test as soon I have time. |
@faebser: Don't worry, we're not in a hurry. Just comment here once done. |
@jonathandturner I don't really get where I have to add the note? |
@faebser - can you add your changes to this PR so we can take a look? |
@jonathandturner I added my try as a commit to the PR. 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 |
Then fix them? I don't know what to add actually. :-/ |
@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. |
The "errors" you see come from So let's see the first one:
It says that an annotation was not found. So let's look to your file:
It means you expect an error to be thrown by the line before this one (the "^" says it). Better like this? |
@GuillaumeGomez: thanks for your comment. I also realised that #1 and #2 were the wrong way around thus generating the error. |
There was a problem hiding this 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` |
There was a problem hiding this comment.
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 ERROR variable y
" with "//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` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@GuillaumeGomez can you please review the third test too? thanks |
All good for me. Please squash your commits now. |
This looks like it only requires squashing, what's blocking this for 2 weeks? |
No clue. :-/ |
caa2204
to
4dde9a5
Compare
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. |
4dde9a5
to
595b754
Compare
@GuillaumeGomez: squash is okay now |
Thanks! @bors: r+ rollup |
📌 Commit 595b754 has been approved by |
⌛ Testing commit 595b754 with merge c80d21d... |
💔 Test failed - auto-linux-cross-opt |
@bors retry |
@bors: retry |
…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
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