Using &T
in where clause should suggest HRTB
#105422
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
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.
Given the following code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0649baa344cf71ca09719ebebe1bf5d2
The current output is:
Ideally the output should suggest adding a HRTB like this:
TBH, HRTB are a very obscure feature to me, and it is not obvious in which circumstances I need to use them. This is one of those, and the compiler should suggest this to me.
I think there are quite some usecases when you have a
Into
/From
that works with a reference, and you want to write code that is generic over thatInto
/From
type.The text was updated successfully, but these errors were encountered: