-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Enhance error message when misspelled label to value in break expression #80023
Enhance error message when misspelled label to value in break expression #80023
Conversation
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
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.
❤️
How does this interact with something like
fn main() {
'qq: loop {
qq;
}
}
if we also emit this help there it probably makes sense to check the source
to check if we are inside of a break expression.
c907313
to
9570008
Compare
Thanks for your review!
How to check that? When I look into |
9570008
to
7d18768
Compare
not actually sure, we probably should try harder to get a relevant Considering that the suggestion can easily be incorrect I feel that a simple help message instead Am happy with whatever you end up prefering. |
@lcnr OK, I'll try to get relevent For |
I look into |
r=me afterwards |
Apply suggestions from code review Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
Update src/test/ui/loops/loop-break-value.rs Co-authored-by: Ivan Tham <pickfire@riseup.net>
fc29077
to
e9ca290
Compare
'LOOP: loop { | ||
LOOP; | ||
//~^ ERROR cannot find value `LOOP` in this scope | ||
}; | ||
'while_loop: while true { //~ WARN denote infinite loops with |
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.
Just wondering, is the recommended label capitalization SCREAMING_SNAKE_CASE
or snake_case
?
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.
the recommended label is snake_case
from what I know
@bors r+ rollup |
📌 Commit e9ca290 has been approved by |
Rollup of 5 pull requests Successful merges: - rust-lang#78164 (Prefer regions with an `external_name` in `approx_universal_upper_bound`) - rust-lang#80003 (Fix overflow when converting ZST Vec to VecDeque) - rust-lang#80023 (Enhance error message when misspelled label to value in break expression) - rust-lang#80046 (Add more documentation to `Diagnostic` and `DiagnosticBuilder`) - rust-lang#80109 (Remove redundant and unreliable coverage test results) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fix #79424