if cond { yield; }
in a generator causes a confusing type error (E0631)
#88653
Labels
A-coroutines
Area: Coroutines
A-diagnostics
Area: Messages for errors, warnings, and lints
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
F-coroutines
`#![feature(coroutines)]`
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code (playground):
The current output is:
This diagnostic seems bizarre since, as far as I'm aware, the type parameter on
Generator
represents the arguments to the generator (like howFn
is represented at the time of writing), and the generator's parameters can be trivially seen to consist of onebool
. Ideally, this should either compile or emit a less confusing diagnostic. I'm not sure whether this is an issue with E0631 or a bug in generators.This still occurs when returning a
bool
from the generator, yielding a different type, giving an explicit type to the generator'sbar
parameter, and when specifying theReturn
andYield
types inimpl Generator
.@rustbot modify labels: +A-generators +D-confusing +F-generators
The text was updated successfully, but these errors were encountered: