region errors: suggest new signature #44506
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
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.
WG-diagnostics
Working group: Diagnostics
In some cases, we can suggest a new signature where the user introduces a new named lifetime. This is a bit tricky to figure out how to format the suggestion. It would get mildly easier with rust-lang/rfcs#2115.
The old code used to produce a modified form of the HIR to format the suggestion. I'd prefer not to do that. I was thinking we could probably do something simpler where we just emit the "new parts" of the signature, maybe like this?
Idea would be to do something like this:
'``a
)fn
foo
)<
, fresh lifetime,…
,>
<
, fresh lifetime,>
(
…
if needed…
if needed…
if needed)
Not sure if this is a good plan. Might be best to wait until the rust-lang/rfcs#2115 is settled, since that would permit us to make a suggestion where we just add a fresh named lifetime, and we don't have to add
<'a>
or anything.The text was updated successfully, but these errors were encountered: