Skip to content

Conversation

varkor
Copy link
Contributor

@varkor varkor commented Sep 29, 2020

Fixes #77156.

@rust-highfive
Copy link
Contributor

r? @lcnr

(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 Sep 29, 2020
@varkor

This comment has been minimized.

@jyn514 jyn514 added A-control-flow Area: Control flow T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 29, 2020
@varkor varkor force-pushed the break-diverging-value branch from 974a61c to 6200e69 Compare September 29, 2020 10:45
@varkor
Copy link
Contributor Author

varkor commented Sep 29, 2020

This is now ready to review.

@lcnr
Copy link
Contributor

lcnr commented Sep 29, 2020

LGTM

don't have much experience with this part of the code though, so r? @eddyb for a final review/approval

@rust-highfive rust-highfive assigned eddyb and unassigned lcnr Sep 29, 2020
@LeSeulArtichaut LeSeulArtichaut added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 16, 2020
@eddyb
Copy link
Member

eddyb commented Oct 18, 2020

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Oct 18, 2020
@varkor varkor force-pushed the break-diverging-value branch from 6200e69 to d415fae Compare October 21, 2020 21:52
}

fn loop_break_return_2() -> i32 { //~ ERROR mismatched types
let loop_value = loop { break { return; () } };
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 change this to break { return 0; () }?

I think in this case I expect // ok, same as break return 0, do you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. However, apparently break { return 0 } (and your example) behave differently than break return 0, so I shall have to investigate.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is because of the point that @eddyb raised earlier.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That did fix it, thanks both. I added the test and it's working as expected now.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 26, 2020

📌 Commit d1c2815 has been approved by nikomatsakis

@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 Oct 26, 2020
@bors
Copy link
Collaborator

bors commented Oct 27, 2020

⌛ Testing commit d1c2815 with merge 824f900...

@bors
Copy link
Collaborator

bors commented Oct 27, 2020

☀️ Test successful - checks-actions
Approved by: nikomatsakis
Pushing 824f900 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 27, 2020
@bors bors merged commit 824f900 into rust-lang:master Oct 27, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-control-flow Area: Control flow merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustc does not recognize a return inside a break expression for purposes of checking that every code path has the function return type
9 participants