Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement assist to add missing lifetime to function #17265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ThouCheese
Copy link
Contributor

To address #11039

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 2024
@ThouCheese ThouCheese force-pushed the feat/unresolved-lifetime-assist branch 6 times, most recently from 0cda9fc to e1316eb Compare May 20, 2024 16:31
@ThouCheese ThouCheese force-pushed the feat/unresolved-lifetime-assist branch from e1316eb to 36fb399 Compare May 20, 2024 20:36
@Veykril
Copy link
Member

Veykril commented May 27, 2024

This should ideally be a quickfix for an unresolved lifetime diagnostic. The origin for the diagnostic to emit would be here

None => error_lifetime(),
, TyLoweringContext has no infrastructure for reporting diagnostics yet though so we'd need to add that as well, best would probably be via callback (Option<&'lt mut dyn FnMut(DiagnosticType)> or similar, Boxing for prototyping is probably better as that doesn't require fiddling with lifetimes first) that is stored in it and that can be set by the caller when creating a TyLoweringContext.

Ultimately it should make its way into the main diagnostics here

pub diagnostics: Vec<InferenceDiagnostic>,
and then be processed like the rest in there.

Also quoting the linked issue:

See how NoSuchField diagnostics is treated, which has a similar flow with a fix: https://github.com/rust-analyzer/rust-analyzer/search?q=NoSuchField.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants