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

Closed

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.

@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 4, 2024
@Veykril
Copy link
Member

Veykril commented Sep 30, 2024

I believe #18074 will make this easier and less messy (no callbacks), so I'll put this into draft until then

@Veykril Veykril marked this pull request as draft September 30, 2024 08:27
@ThouCheese ThouCheese closed this Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants