Skip to content

Commit 585afb9

Browse files
committed
? desugaring
1 parent 6b3726e commit 585afb9

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

text/0000-gen-fn.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,28 @@ This is the technical portion of the RFC. Explain the design in sufficient detai
126126

127127
The section should return to the examples given in the previous section, and explain more fully how the detailed proposal makes those examples work.
128128

129+
## New keyword
130+
131+
In the 2024 edition we reserve `gen` as a keyword. Previous editions need to use `k#gen` to get the same features.
132+
129133
## Error handling
130134

131-
`?` desugars to
135+
`foo?` in `gen` blocks desugars to
136+
137+
```rust
138+
match foo {
139+
Err(err) => {
140+
yield Err(err.into());
141+
return;
142+
},
143+
Ok(val) => val,
144+
}
145+
```
132146

133147
# Drawbacks
134148
[drawbacks]: #drawbacks
135149

136-
Why should we *not* do this?
150+
It's another language feature for something that can already be written entirely in user code.
137151

138152
# Rationale and alternatives
139153
[rationale-and-alternatives]: #rationale-and-alternatives

0 commit comments

Comments
 (0)