-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
if cond { yield; } in a generator causes a confusing type error (E0631) #88653
Copy link
Copy link
Closed
Labels
A-coroutinesArea: CoroutinesArea: CoroutinesA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.F-coroutines`#![feature(coroutines)]``#![feature(coroutines)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-coroutinesArea: CoroutinesArea: CoroutinesA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.F-coroutines`#![feature(coroutines)]``#![feature(coroutines)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Given the following code (playground):
The current output is:
This diagnostic seems bizarre since, as far as I'm aware, the type parameter on
Generatorrepresents the arguments to the generator (like howFnis 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
boolfrom the generator, yielding a different type, giving an explicit type to the generator'sbarparameter, and when specifying theReturnandYieldtypes inimpl Generator.@rustbot modify labels: +A-generators +D-confusing +F-generators