-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Unhelpful error messages for trait with unbound lifetime #72106
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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.
I was trying to implement FromSql of
rusqlitefor my reference type (with lifetime). And I faced an unclear error message, later I was explained that the trait does not allow the return type to borrow from the value argument since it doesn't specify lifetime parameter explicitly.However, I thought that it worth filing a bug report about unhelpful error message anyway.
Here is a simplified code:
The error message I'm getting is:
So basically it says that I have a wrong signature, even though the expected and found signatures are the same.
I'm not sure what would be the right error message to raise here since I don't know lifetime rules quite well.
Here is, just in case, a link to playground
The rust version I'm using is:
1.44.0-nightly, but it also reproduces on1.43.1.