Skip to content

Conversation

@DominicPM
Copy link
Contributor

@DominicPM DominicPM commented Jan 31, 2026

Can now use Boolean-valued pattern guards, for example:

match x with {
  Some(x) if x > 0 => ...,
  None => ...,
  _otherwise => ...
}

Closes #67.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- Make pattern translations total and tolerate wrapper forms to avoid Match in
  the bcase frontend.
- Allow nested patterns in constructor args by expanding collection/translation
  logic in Basic_Case_Expression.
- Normalize tuple patterns into Pair/TNil shape in the shallow match frontend.
- Improve shallow match arg translation to distinguish bindings vs constructors
  and handle nested tuple patterns.
- Add nested-pattern showcase/regression tests (Option/Result, tuples, wildcards,
  if-let and let-else forms).

Closes awslabs#65.

Signed-off-by: Dominic Mulligan <dominic.p.mulligan@gmail.com>
Can now use Boolean-valued pattern guards, for example:

```rust
match x with {
  Some(x) if x > 0 => ...,
  None => ...,
  _otherwise => ...
}
```

Closes awslabs#67.

Signed-off-by: Dominic Mulligan <dominic.p.mulligan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for match guards (pat if cond) in Micro Rust

1 participant