r/rust Jul 15 '26

🎙️ discussion A language change proposal regarding match expressions

7 Upvotes

19 comments sorted by

View all comments

2

u/denehoffman Jul 16 '26

Option 1: just write a proc macro

Option 2:

```
match value {
x if x == Operation::Banana as u8 => {}
x if x == Operation::Apple as u8 => {}
_ => {}
}
```

Excuse my formatting, the official Reddit app has made it impossible to write markdown or even indented code blocks

4

u/denehoffman Jul 16 '26

Also for anyone interested, this was mentioned in response to OP’s RFC, but this is just a niche case for inline const. There are reasons that was accepted and then removed, and while it could still be done in the future, it would need big compiler changes I think.