NLL: suggested rewritten input types should preserve user-written lifetimes when needed #52880
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-NLL
Area: Non-lexical lifetimes (NLL)
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
NLL-diagnostics
Working towards the "diagnostic parity" goal
While working on #52663, I saw a collection of cases where the
.nll.stderr
files shows that we are currently generating a diagnostic where we suggest the user do something like change a&
-type to a&mut
-type, but the problem is that in adding themut
, we seem to lose bits of the original input type that it probably needs, such as explicit lifetimes.See for example:
rust/src/test/ui/did_you_mean/issue-39544.nll.stderr
Lines 12 to 13 in fefe816
rust/src/test/ui/did_you_mean/issue-39544.nll.stderr
Lines 37 to 38 in fefe816
rust/src/test/ui/did_you_mean/issue-39544.nll.stderr
Lines 54 to 55 in fefe816
rust/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
Lines 28 to 29 in fefe816
rust/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
Lines 60 to 61 in fefe816
rust/src/test/ui/span/mut-arg-hint.nll.stderr
Lines 12 to 13 in fefe816
rust/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.nll.stderr
Lines 4 to 5 in fefe816
rust/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.nll.stderr
Lines 12 to 13 in fefe816
The text was updated successfully, but these errors were encountered: