Unhelpful diagnostic for sort_by_key lifetime issue #92039
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=132fc68312d40c6ed0d878b1d5bdb711
The current output is:
Ideally the output should explain the lifetime issue somehow rather than saying "one type is more general than the other" for two identical types. I understand that the reason why this code doesn't work is as described in https://stackoverflow.com/questions/47121985/why-cant-i-use-a-key-function-that-returns-a-reference-when-sorting-a-vector-wi but this error output wasn't informative :)
The text was updated successfully, but these errors were encountered: