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

Add suggestion to "use break" when attempting to implicit-break a loop #84516

Merged
merged 5 commits into from
Apr 26, 2021

Conversation

torhovland
Copy link
Contributor

Fixes #84114

@rust-highfive
Copy link
Collaborator

r? @estebank

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 24, 2021
@estebank
Copy link
Contributor

Could you add some tests exercising these changes?

@torhovland torhovland marked this pull request as ready for review April 24, 2021 17:01
@torhovland
Copy link
Contributor Author

Could you add some tests exercising these changes?

Sure, it's ready now.


loop {
return 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add another case of loop { 1 } as foo's tail expression? That could suggest either return or break, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Yes, I thought it best to output no more than one of the suggestions, so that case is suggesting return as before. Note that this is also the case with the third error, hence this new test case may seem a bit redundant.

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Apr 25, 2021

📌 Commit 3b50461 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 25, 2021
Add suggestion to "use break" when attempting to implicit-break a loop

Fixes rust-lang#84114
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 25, 2021
Add suggestion to "use break" when attempting to implicit-break a loop

Fixes rust-lang#84114
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 25, 2021
Add suggestion to "use break" when attempting to implicit-break a loop

Fixes rust-lang#84114
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#84235 (refactor StyledBuffer)
 - rust-lang#84450 (Give a better error when `std` or `core` are missing)
 - rust-lang#84486 (Handle pretty printing of `else if let` clauses without ICEing)
 - rust-lang#84499 (Tweak trait not `use`d suggestion)
 - rust-lang#84516 (Add suggestion to "use break" when attempting to implicit-break a loop)
 - rust-lang#84520 (Improve diagnostics for function passed when a type was expected.)
 - rust-lang#84541 (Inline most raw socket, fd and handle conversions)
 - rust-lang#84547 (Get rid of is_min_const_fn)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ad3389a into rust-lang:master Apr 26, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 26, 2021
@bors
Copy link
Contributor

bors commented Apr 26, 2021

⌛ Testing commit 3b50461 with merge f8f5968...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add hint to "use break" when attempting to implicit-break a loop
5 participants