-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Diagnostic recommends + '_ instead of + use<'_> or nothing to express capturing #144043
Copy link
Copy link
Open
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
Current output
Desired output
Rationale and extra context
Legacy from #72543 when we didn't have precise capturing and a good understanding of outlives vs captures relationships.
We should probably replace the advice for the RPIT with
impl Debug + use<'_>. On edition 2024, the RPIT hint should be removed altogether -- there doesn't seem to be any check against recommending implicit captures currently.I have no idea about the right solution for
dyn. We could maybe leave it as-is, butcurrently recommends to add both
+ 'aand+ 'b, which obviously doesn't work. Does anyone know if there's ongoing work on addingusetodyn?Other cases
Rust Version
Anything else?
No response