"error: illegal recursive type; insert an enum or struct in the cycle, if this is desired" not very helpful #17539
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I've tried to write code that would work like this:
To make coding some_fn and its friends easier, I wanted to create a type:
Unfortunately, this results in some type-theoretic error message that isn't really understandable by mere mortals:
It's not at all clear what 'the cycle' is and where to insert an enum or struct. Turns out that if you know what the compiler is talking about, the fix is simple:
Output:
But I was very confused by the message and tried a contraption like this instead:
A hint in the error message that points the programmer to the right direction would be very helpful. Ergonomy of the solution is also questionable, but at least it compiles.
The text was updated successfully, but these errors were encountered: