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

Allow Downcast projections unconditionally in const-checking #71688

Merged
merged 2 commits into from
May 1, 2020

Conversation

ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented Apr 29, 2020

ProjectionElem::Downcast sounds scary, but it's really just the projection we use to access a particular enum variant. They usually appear in the lowering of a match statement, so they have been associated with control flow in const-checking, but they don't do any control flow by themselves. We already have a HIR pass that looks for if and match (even ones that have 1 or fewer reachable branches). That pass is double-checked by a MIR pass that looks for SwitchInts and FakeReads for match scrutinees. In my opinion, there's no need to look for Downcast as well.

r? @oli-obk

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 29, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Apr 30, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Apr 30, 2020

📌 Commit 0592976 has been approved by oli-obk

@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 30, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 30, 2020
Rollup of 8 pull requests

Successful merges:

 - rust-lang#71148 (Vec drop and truncate: drop using raw slice *mut [T])
 - rust-lang#71465 (Add a convenience method on `TyCtxt` for checking for thread locals)
 - rust-lang#71567 (Handle build completion message from Cargo)
 - rust-lang#71590 (MIR dump: print pointers consistently with Miri output)
 - rust-lang#71682 (Bump pulldown-cmark)
 - rust-lang#71688 (Allow `Downcast` projections unconditionally in const-checking)
 - rust-lang#71691 (Allow `Unreachable` terminators unconditionally in const-checking)
 - rust-lang#71719 (Update backtrace-sys)

Failed merges:

r? @ghost
@bors bors merged commit a8e0511 into rust-lang:master May 1, 2020
@ecstatic-morse ecstatic-morse deleted the const-downcast branch October 6, 2020 01:42
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.

4 participants