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

match lowering: Lower bindings in a predictable order #121716

Merged
merged 3 commits into from
Mar 3, 2024

Conversation

Nadrieril
Copy link
Member

After the recent refactorings, we can now lower bindings in a truly predictable order. The order in #120214 was an improvement but not very clear. With this PR, we lower bindings from left to right, with the special case that x @ pat is traversed as pat @ x (i.e. x is lowered after any bindings in pat).

This description only applies in the absence of or-patterns. Or-patterns make everything complicated, because the binding place depends on the subpattern. Until I have a better idea I leave them to be handled in whatever weird order arises from today's code.

r? @matthewjasper

For some reason it doesn't figure out the slice coercion.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 28, 2024
@rust-log-analyzer

This comment has been minimized.

@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 1, 2024

📌 Commit 00497ad has been approved by matthewjasper

It is now in the queue for this repository.

@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 Mar 1, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 2, 2024
Rollup of 5 pull requests

Successful merges:

 - rust-lang#120761 (Add initial support for DataFlowSanitizer)
 - rust-lang#121622 (Preserve same vtable pointer when cloning raw waker, to fix Waker::will_wake)
 - rust-lang#121716 (match lowering: Lower bindings in a predictable order)
 - rust-lang#121731 (Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore)
 - rust-lang#121841 (`f16` and `f128` step 2: intrinsics)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 30976fb into rust-lang:master Mar 3, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 3, 2024
Rollup merge of rust-lang#121716 - Nadrieril:simple-binding-order, r=matthewjasper

match lowering: Lower bindings in a predictable order

After the recent refactorings, we can now lower bindings in a truly predictable order. The order in rust-lang#120214 was an improvement but not very clear. With this PR, we lower bindings from left to right, with the special case that `x @ pat` is traversed as `pat @ x` (i.e. `x` is lowered after any bindings in `pat`).

This description only applies in the absence of or-patterns. Or-patterns make everything complicated, because the binding place depends on the subpattern. Until I have a better idea I leave them to be handled in whatever weird order arises from today's code.

r? `@matthewjasper`
@Nadrieril Nadrieril deleted the simple-binding-order branch March 3, 2024 01:30
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. 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.

5 participants