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

Lower Guard Patterns to HIR. #134989

Merged
merged 4 commits into from
Jan 8, 2025
Merged

Conversation

max-niederman
Copy link
Contributor

@max-niederman max-niederman commented Jan 1, 2025

Implements lowering of guard patterns (see the tracking issue) to HIR.

@rustbot
Copy link
Collaborator

rustbot commented Jan 1, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 1, 2025

Some changes occurred in match checking

cc @Nadrieril

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 1, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Nadrieril
Copy link
Member

Could you add tests for (x if guard(y), y) and (y, x if guard(y))? Both should be errors but I believe that this PR accepts the second one. That's what got me stuck on this feature.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 1, 2025

Could you add tests for (x if guard(y), y) and (y, x if guard(y))? Both should be errors but I believe that this PR accepts the second one. That's what got me stuck on this feature.

Oof funky case. I think we'd want to reject this at the nameres level?

@Nadrieril
Copy link
Member

Oh wait I thought this PR included nameres, nevermind. That remark will be for the next PR :D

@oli-obk
Copy link
Contributor

oli-obk commented Jan 7, 2025

@bors r+

@bors
Copy link
Contributor

bors commented Jan 7, 2025

📌 Commit 8cefc0a has been approved by oli-obk

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 Jan 7, 2025
@@ -435,6 +435,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {

hir::PatKind::Or(pats) => PatKind::Or { pats: self.lower_patterns(pats) },

// FIXME(guard_patterns): implement guard pattern lowering
hir::PatKind::Guard(pat, _) => self.lower_pattern(pat).kind,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe emit an error here instead until the correct lowering is implemented?

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 7, 2025
…r=oli-obk

Lower Guard Patterns to HIR.

Implements lowering of [guard patterns](https://rust-lang.github.io/rfcs/3637-guard-patterns.html) (see the [tracking issue](rust-lang#129967)) to HIR.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#131146 (Stop clearing box's drop flags early)
 - rust-lang#133810 (remove unnecessary `eval_verify_bound`)
 - rust-lang#134745 (Normalize each signature input/output in `typeck_with_fallback` with its own span)
 - rust-lang#134989 (Lower Guard Patterns to HIR.)
 - rust-lang#135149 (Use a post-monomorphization typing env when mangling components that come from impls)
 - rust-lang#135171 (rustdoc: use stable paths as preferred canonical paths)
 - rust-lang#135200 (rustfmt: drop nightly-gating of the `--style-edition` flag registration)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#133810 (remove unnecessary `eval_verify_bound`)
 - rust-lang#134745 (Normalize each signature input/output in `typeck_with_fallback` with its own span)
 - rust-lang#134989 (Lower Guard Patterns to HIR.)
 - rust-lang#135149 (Use a post-monomorphization typing env when mangling components that come from impls)
 - rust-lang#135171 (rustdoc: use stable paths as preferred canonical paths)
 - rust-lang#135200 (rustfmt: drop nightly-gating of the `--style-edition` flag registration)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a20d0d5 into rust-lang:master Jan 8, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 8, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2025
Rollup merge of rust-lang#134989 - max-niederman:guard-patterns-hir, r=oli-obk

Lower Guard Patterns to HIR.

Implements lowering of [guard patterns](https://rust-lang.github.io/rfcs/3637-guard-patterns.html) (see the [tracking issue](rust-lang#129967)) to HIR.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 9, 2025
…r=oli-obk

Lower Guard Patterns to HIR.

Implements lowering of [guard patterns](https://rust-lang.github.io/rfcs/3637-guard-patterns.html) (see the [tracking issue](rust-lang#129967)) to HIR.
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants