Better errors for polymorphic recursion #136528
Labels
A-destructors
Area: Destructors (`Drop`, …)
A-diagnostics
Area: Messages for errors, warnings, and lints
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-verbose
Diagnostics: Too much output caused by a single piece of incorrect code.
I-monomorphization
Issue: An error at monomorphization time.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Not sure what an ideal output would be (Is polymorphic recursion too complex/confusing a term? Presumably if someone is writing code like the above they might know what it is), but ideally something that doesn't spam ~120
Vec
s at you when erroring.Rationale and extra context
Polymorphic recursion is not valid in rust, due to both drop restrictions (what causes the error above), and monomorphization restrictions (it cannot be monomorphized). The current errors are not very explanatory as to what the core issue is.
Other cases
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: