feature(gen_blocks): cannot use the ? operator in a gen block that returns ()
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
As per gen_blocks RFC:
Even when ? is used within a gen block, the block must return a value of type unit or !. That is, it does not return a value of Some(..), Ok(..), or Continue(..) as other such blocks might.
But currently upon using ? an error occurs: cannot use the ? operator in a gen block that returns ()
To reproduce: https://godbolt.org/z/4fGT9EM8q
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the error with the Godbolt example linked in the issue and read the gen_blocks RFC rule quoted in the report. Trace how the compiler handles ? in a gen block returning (), then verify that the example compiles with the intended unit-or-never behavior and that existing gen-block diagnostics remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100