Mismatched lifetime on trait impl shows a misleading error #80701
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
A-trait-system
Area: Trait system
C-bug
Category: This is a bug.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The rust compiler gives a very poor error message when there is a lifetime expectation mismatch on trait usage.
I used this code: (playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=581fa159f8ff99f2df447308fccd4bbc )
I expected to see a useful error message, such as "expected trait
BaseSetter<'a>
, found trait:BaseSetter<'static>
"Instead, I was greeted with this almost useless error message: "expected trait
BaseSetter
, found traitBaseSetter
"The same error occurs on stable and nightly compilers
The text was updated successfully, but these errors were encountered: