Skip to content

Option::get_or_insert(_with): Replace unreachable! with unreachable_unchecked #51653

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

Merged
merged 1 commit into from
Jun 23, 2018
Merged

Option::get_or_insert(_with): Replace unreachable! with unreachable_unchecked #51653

merged 1 commit into from
Jun 23, 2018

Conversation

mglagla
Copy link
Contributor

@mglagla mglagla commented Jun 20, 2018

Optimize codegen for both functions as the None branch is trivially not reachable.

@rust-highfive
Copy link
Contributor

r? @TimNN

(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 Jun 20, 2018
@arthurprs
Copy link
Contributor

Interestingly enough, the second check is only optimized out when the lambda is trivial (I guess optimizer sees no possible side effects) https://godbolt.org/g/dPXVTr

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks!

@dtolnay
Copy link
Member

dtolnay commented Jun 23, 2018

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 23, 2018

📌 Commit 11341e2 has been approved by dtolnay

@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 Jun 23, 2018
bors added a commit that referenced this pull request Jun 23, 2018
Option::get_or_insert(_with): Replace unreachable! with unreachable_unchecked

Optimize codegen for both functions as the None branch is trivially not reachable.
@bors
Copy link
Collaborator

bors commented Jun 23, 2018

⌛ Testing commit 11341e2 with merge 60efbde...

@bors
Copy link
Collaborator

bors commented Jun 23, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: dtolnay
Pushing 60efbde to master...

@bors bors merged commit 11341e2 into rust-lang:master Jun 23, 2018
@mglagla mglagla deleted the option-unreachable branch June 24, 2018 07:24
@dtolnay dtolnay assigned dtolnay and unassigned TimNN Mar 24, 2024
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.

6 participants